diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4636a1bdd1..046c285442 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,17 +1,17 @@ name: Node CI on: - push: + push: branches: - main - pull_request: + pull_request: branches: - main jobs: upload-designer-codecov: runs-on: ubuntu-latest - # if: ${{ github.event.pull_request.head.repo.full_name == 'alibaba/lowcode-engine' }} + # if: ${{ github.event.pull_request.head.repo.full_name == 'fe-lce/lowcode-engine' }} steps: - name: checkout uses: actions/checkout@v2 @@ -90,7 +90,7 @@ jobs: upload-code-generator: runs-on: ubuntu-latest - # if: ${{ github.event.pull_request.head.repo.full_name == 'alibaba/lowcode-engine' }} + # if: ${{ github.event.pull_request.head.repo.full_name == 'fe-lce/lowcode-engine' }} steps: - name: checkout uses: actions/checkout@v2 @@ -113,4 +113,4 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} name: code-generator fail_ci_if_error: true - verbose: true \ No newline at end of file + verbose: true diff --git a/.github/workflows/cov packages.yml b/.github/workflows/cov packages.yml index 7f92e1009c..90f6639e49 100644 --- a/.github/workflows/cov packages.yml +++ b/.github/workflows/cov packages.yml @@ -10,7 +10,7 @@ jobs: cov-designer: runs-on: ubuntu-latest # skip fork's PR, otherwise it fails while making a comment - if: ${{ github.event.pull_request.head.repo.full_name == 'alibaba/lowcode-engine' }} + if: ${{ github.event.pull_request.head.repo.full_name == 'fe-lce/lowcode-engine' }} steps: - name: checkout uses: actions/checkout@v2 @@ -32,7 +32,7 @@ jobs: cov-renderer-core: runs-on: ubuntu-latest # skip fork's PR, otherwise it fails while making a comment - if: ${{ github.event.pull_request.head.repo.full_name == 'alibaba/lowcode-engine' }} + if: ${{ github.event.pull_request.head.repo.full_name == 'fe-lce/lowcode-engine' }} steps: - name: checkout uses: actions/checkout@v2 @@ -54,7 +54,7 @@ jobs: cov-react-simulator-renderer: runs-on: ubuntu-latest # skip fork's PR, otherwise it fails while making a comment - if: ${{ github.event.pull_request.head.repo.full_name == 'alibaba/lowcode-engine' }} + if: ${{ github.event.pull_request.head.repo.full_name == 'fe-lce/lowcode-engine' }} steps: - name: checkout uses: actions/checkout@v2 @@ -76,7 +76,7 @@ jobs: cov-utils: runs-on: ubuntu-latest # skip fork's PR, otherwise it fails while making a comment - if: ${{ github.event.pull_request.head.repo.full_name == 'alibaba/lowcode-engine' }} + if: ${{ github.event.pull_request.head.repo.full_name == 'fe-lce/lowcode-engine' }} steps: - name: checkout uses: actions/checkout@v2 @@ -93,4 +93,4 @@ jobs: working-directory: packages/utils test-script: npm test -- --jest-ci --jest-json --jest-coverage --jest-testLocationInResults --jest-outputFile=report.json package-manager: yarn - annotations: none \ No newline at end of file + annotations: none diff --git a/.github/workflows/insufficient information.yml b/.github/workflows/insufficient information.yml index c49e133f16..70f0be05fb 100644 --- a/.github/workflows/insufficient information.yml +++ b/.github/workflows/insufficient information.yml @@ -16,4 +16,4 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} body: | - 你好 @${{ github.event.issue.user.login }},由于缺乏必要的信息(如 bug 重现步骤、引擎版本信息 等),无法定位问题,请按照 [issue bug 模板](https://github.com/alibaba/lowcode-engine/blob/main/.github/ISSUE_TEMPLATE/bug-report.md) 补全信息,也可以通过阅读 [引擎的 issue 说明](https://lowcode-engine.cn/site/community/issue) 了解什么类型的 issue 可以获得更好、更快的支持。 + 你好 @${{ github.event.issue.user.login }},由于缺乏必要的信息(如 bug 重现步骤、引擎版本信息 等),无法定位问题,请按照 [issue bug 模板](https://github.com/fe-lce/lowcode-engine/blob/main/.github/ISSUE_TEMPLATE/bug-report.md) 补全信息,也可以通过阅读 [引擎的 issue 说明](https://lowcode-engine.cn/site/community/issue) 了解什么类型的 issue 可以获得更好、更快的支持。 diff --git a/README-en_US.md b/README-en_US.md new file mode 100644 index 0000000000..02e5973621 --- /dev/null +++ b/README-en_US.md @@ -0,0 +1 @@ +packages/engine/README-en_US.md diff --git a/README-zh_CN.md b/README-zh_CN.md deleted file mode 120000 index f02eb04953..0000000000 --- a/README-zh_CN.md +++ /dev/null @@ -1 +0,0 @@ -packages/engine/README-zh_CN.md \ No newline at end of file diff --git a/README.md b/README.md index 2fcba628f4..9d986c32c8 120000 --- a/README.md +++ b/README.md @@ -1 +1 @@ -packages/engine/README.md \ No newline at end of file +packages/engine/README.md diff --git a/docs/community/issue.md b/docs/community/issue.md index 2b6bd0f962..9e12e49a43 100644 --- a/docs/community/issue.md +++ b/docs/community/issue.md @@ -2,17 +2,17 @@ title: 关于引擎的 issue 说明 sidebar_position: 2 --- -> 提交地址:[https://github.com/alibaba/lowcode-engine/issues](https://github.com/alibaba/lowcode-engine/issues) + +> 提交地址:[https://github.com/fe-lce/lowcode-engine/issues](https://github.com/fe-lce/lowcode-engine/issues) ### 提交前必读 -由于引擎项目复杂,很多问题在复现和沟通上无法花费太多时间,需要大家尽力将复现步骤说明白。 +由于引擎项目复杂,很多问题在复现和沟通上无法花费太多时间,需要大家尽力将复现步骤说明白。 ![image.png](./img/you-think.png) **你以为的 issue** - ![image.png](./img/i-see.png) **我们看到的 issue** @@ -26,18 +26,21 @@ sidebar_position: 2 - 【支持慢】有完整的项目地址,下载下来可直接安装依赖并启动复现的 - 【支持慢】需求类型的由于人力有限,欢迎大家 PR,如能讲清楚背景上下文和场景,项目维护团队更容易给出方案建议或方向指引。 - 【不保证提供支持】其他 - - 只有标题没有复现步骤 - - 复现步骤不清晰 - - 和引擎无关的 + - 只有标题没有复现步骤 + - 复现步骤不清晰 + - 和引擎无关的 ### 不同优先级的示例 + #### 【支持快】通过线上 Demo 地址 + 控制台输入 API 可复现。 + **示例** ![image.png](https://img.alicdn.com/imgextra/i1/O1CN01np6ARb1KnJFOELjXg_!!6000000001208-2-tps-3322-1862.png) 复现步骤: - 打开线上 demo - 在控制台输入 + ```json // 当前 doc const doc = window.AliLowCodeEngine.project.currentDocument @@ -56,6 +59,7 @@ window.AliLowCodeEngine.project.openDocument('docl4xkca5b') - 使用 openDocument 可以正常的切换回原来的 doc #### 【支持快】通过线上 demo + 导入 schema 可复现 + 步骤: - 使用线上 demo @@ -68,8 +72,8 @@ window.AliLowCodeEngine.project.openDocument('docl4xkca5b') - 页面中的 xxx 部分和预期不符合,期望的效果是 xxx #### 【支持稍慢】通过线上 demo + 完整操作步骤可复现 -**示例** -1.使用 antd 组件 + +**示例** 1.使用 antd 组件 ![image.png](https://img.alicdn.com/imgextra/i4/O1CN019dFe4Y24SDKbmpbdw_!!6000000007389-2-tps-3584-1812.png) 2.拖拽这个组件 @@ -83,6 +87,7 @@ window.AliLowCodeEngine.project.openDocument('docl4xkca5b') - 组件同配置一致 #### 【支持稍慢】通过线上 demo + 变更代码可复现,并清楚的说明变更代码的位置和内容 + **示例** ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01FL0Urq1tl1pLcYhJH_!!6000000005941-2-tps-1892-754.png) @@ -93,20 +98,23 @@ window.AliLowCodeEngine.project.openDocument('docl4xkca5b') ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01OKzt1Z28b9WZIbM6B_!!6000000007950-2-tps-1912-914.png) #### 【支持慢】有完整的项目地址,下载下来可直接安装依赖并启动复现的 + 由于完整的项目中有很多冗余的信息,这部分排查起来十分耗时且困难。不推荐使用改方式。 #### 【不保证提供支持】其他 + ##### 只有标题没有复现步骤 + ![image.png](https://img.alicdn.com/imgextra/i3/O1CN017rO2gR1YKpEgIMBjh_!!6000000003041-2-tps-2520-1020.png) ##### 复现步骤不清晰 + ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01vtHi5z225CC7aFVS2_!!6000000007068-2-tps-3584-1666.png) ##### 和引擎无关的 -![image.png](https://img.alicdn.com/imgextra/i2/O1CN01KxqT9M1vcu25xJHFP_!!6000000006194-2-tps-2548-1430.png) - - +![image.png](https://img.alicdn.com/imgextra/i2/O1CN01KxqT9M1vcu25xJHFP_!!6000000006194-2-tps-2548-1430.png) ### 扩展阅读 + 强烈推荐阅读 [《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)、[《如何向开源社区提问题》](https://github.com/seajs/seajs/issues/545) 和 [《如何有效地报告 Bug》](http://www.chiark.greenend.org.uk/~sgtatham/bugs-cn.html)、[《如何向开源项目提交无法解答的问题》](https://zhuanlan.zhihu.com/p/25795393),更好的问题更容易获得帮助。(此段参考 [antd](https://github.com/ant-design/ant-design)) diff --git a/docs/config/navbar.js b/docs/config/navbar.js index 24f8a39376..2eadcb3c8e 100644 --- a/docs/config/navbar.js +++ b/docs/config/navbar.js @@ -65,7 +65,7 @@ module.exports = { // }, // { { - href: 'https://github.com/alibaba/lowcode-engine', + href: 'https://github.com/fe-lce/lowcode-engine', position: 'right', className: 'header-github-link', 'aria-label': 'GitHub repository', diff --git a/docs/config/sidebars.js b/docs/config/sidebars.js index b8a7587d91..031a25c57d 100644 --- a/docs/config/sidebars.js +++ b/docs/config/sidebars.js @@ -39,7 +39,9 @@ module.exports = { type: 'category', label: '扩展编辑器', collapsed: false, - items: getDocsFromDir('guide/expand/editor', [{ dir: 'guide/expand/editor/parts', label: 'Parts·造物' }]), + items: getDocsFromDir('guide/expand/editor', [ + { dir: 'guide/expand/editor/parts', label: 'Parts·造物' }, + ]), }, { type: 'category', @@ -61,7 +63,7 @@ module.exports = { { type: 'link', label: '更新日志', - href: 'https://github.com/alibaba/lowcode-engine/releases', + href: 'https://github.com/fe-lce/lowcode-engine/releases', }, ...getDocsFromDir('guide/appendix'), { diff --git a/docs/docs/api/canvas.md b/docs/docs/api/canvas.md index 865b9ac311..76586e66c3 100644 --- a/docs/docs/api/canvas.md +++ b/docs/docs/api/canvas.md @@ -3,9 +3,7 @@ title: canvas - 画布 API sidebar_position: 10 --- -> **@types** [IPublicApiCanvas](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/canvas.ts)
-> **@since** v1.1.0 - +> **@types** [IPublicApiCanvas](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/canvas.ts)
> **@since** v1.1.0 ## 模块简介 @@ -19,8 +17,7 @@ sidebar_position: 10 `@type {IPublicModelDragon | null}` - -相关类型:[IPublicModelDragon](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/dragon.ts) +相关类型:[IPublicModelDragon](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/dragon.ts) ### activeTracker @@ -28,7 +25,7 @@ sidebar_position: 10 `@type {IPublicModelActiveTracker | null}` -相关类型:[IPublicModelActiveTracker](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/active-tracker.ts) +相关类型:[IPublicModelActiveTracker](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/active-tracker.ts) ### isInLiveEditing @@ -37,15 +34,17 @@ sidebar_position: 10 `@type {boolean}` ### clipboard + 全局剪贴板实例 `@type {IPublicModelClipboard}` -相关类型:[IPublicModelClipboard](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/clipboard.ts) +相关类型:[IPublicModelClipboard](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/clipboard.ts) ## 方法 ### createLocation + 创建一个文档插入位置对象,该对象用来描述一个即将插入的节点在文档中的位置 ```typescript @@ -58,7 +57,9 @@ createLocation(locationData: IPublicTypeLocationData): IPublicModelDropLocation; ``` ### createScroller + 创建一个滚动控制器 Scroller,赋予一个视图滚动的基本能力, + ```typescript /** * 创建一个滚动控制器 Scroller,赋予一个视图滚动的基本能力, @@ -75,6 +76,7 @@ createScroller(scrollable: IPublicTypeScrollable): IPublicModelScroller; ``` ### createScrollTarget + 创建一个 ScrollTarget,与 Scroller 一起发挥作用,详见 [createScroller](#createscroller) 中的描述 ```typescript diff --git a/docs/docs/api/common.md b/docs/docs/api/common.md index c278bf2ad8..97064ef726 100644 --- a/docs/docs/api/common.md +++ b/docs/docs/api/common.md @@ -3,26 +3,32 @@ title: common - 通用 API sidebar_position: 10 --- -> **@types** [IPublicApiCommon](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/common.ts)
-> **@since** v1.0.0 - +> **@types** [IPublicApiCommon](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/common.ts)
> **@since** v1.0.0 ## 模块简介 + 通用模块里包含除了几大核心模块 API 之外的所有 API,比如通用 utils、面板扩展相关 等。 + > 高能预警:之所以叫 skeletonCabin / designerCabin 跟兼容上一个版本的引擎有关系。若有必要,后面将用更有意义的命名空间来组织这些 API。 ## 变量 + #### utils + 通用 utils,详见下方方法签名 -相关类型:[IPublicApiCommonUtils](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/common.ts) +相关类型:[IPublicApiCommonUtils](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/common.ts) #### skeletonCabin + 面板扩展相关,详见下方方法签名 ## 方法 + ### utils + #### isNodeSchema + 是否为合法的 schema 结构 ```typscript @@ -37,6 +43,7 @@ isNodeSchema(data: any): boolean; ``` #### isFormEvent + 是否为表单事件类型 ```typescript @@ -50,7 +57,9 @@ isFormEvent(e: KeyboardEvent | MouseEvent): boolean; ``` #### getNodeSchemaById + 从 schema 结构中查找指定 id 节点 + ```typescript /** * 从 schema 结构中查找指定 id 节点 @@ -64,9 +73,11 @@ getNodeSchemaById( nodeId: string, ): IPublicTypeNodeSchema | undefined; ``` -相关类型:[IPublicTypeNodeSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) + +相关类型:[IPublicTypeNodeSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) #### executeTransaction + 批处理事务,用于优化特定场景的性能 ```typescript @@ -80,12 +91,14 @@ getNodeSchemaById( */ executeTransaction(fn: () => void, type: IPublicEnumTransitionType): void; ``` + **@since v1.0.16** **示例** + ```typescript -import { common } from '@alilc/lowcode-engine'; -import { IPublicEnumTransitionType } from '@alilc/lowcode-types'; +import { common } from '@felce/lowcode-engine'; +import { IPublicEnumTransitionType } from '@felce/lowcode-types'; common.utils.startTransaction(() => { node1.setProps(); @@ -107,7 +120,9 @@ getConvertedExtraKey(key: string): string **@since v1.0.17** #### createIntl + i18n 相关工具 + ```typescript /** * i18n 相关工具 @@ -135,7 +150,7 @@ createIntl(instance: string | object): { **示例** ```typescript -import { common } from '@alilc/lowcode-engine'; +import { common } from '@felce/lowcode-engine'; import enUS from './en-US.json'; import zhCN from './zh-CN.json'; @@ -143,7 +158,6 @@ const { intl, getLocale, setLocale } = common.utils.createIntl({ 'en-US': enUS, 'zh-CN': zhCN, }); - ``` #### intl @@ -158,12 +172,15 @@ intl(data: IPublicTypeI18nData | string, params?: object): string; ``` **示例** + ``` const title = common.utils.intl(node.title) ``` ### skeletonCabin + #### Workbench + 编辑器框架 View ```typescript diff --git a/docs/docs/api/config.md b/docs/docs/api/config.md index 414cfc979f..c06a80ba98 100644 --- a/docs/docs/api/config.md +++ b/docs/docs/api/config.md @@ -3,15 +3,16 @@ title: config - 配置 API sidebar_position: 5 --- -> **@types** [IPublicModelEngineConfig](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/engine-config.ts)
-> **@since** v1.0.0 - +> **@types** [IPublicModelEngineConfig](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/engine-config.ts)
> **@since** v1.0.0 ## 模块简介 + 配置模块,负责配置的读、写等操作。 ## 方法 + ### get + 获取指定 key 的值 ```typescript @@ -24,14 +25,18 @@ sidebar_position: 5 */ get(key: string, defaultValue?: any): any; ``` + **示例** + ```typescript -import { config } from '@alilc/lowcode-engine'; +import { config } from '@felce/lowcode-engine'; config.get('keyA', true); config.get('keyB', { a: 1 }); ``` + ### set + 设置指定 key 的值 ```typescript @@ -43,14 +48,17 @@ config.get('keyB', { a: 1 }); */ set(key: string, value: any): void; ``` + **示例** + ```typescript -import { config } from '@alilc/lowcode-engine'; +import { config } from '@felce/lowcode-engine'; config.set('keyC', 1); ``` ### has + 判断指定 key 是否有值 ```typescript @@ -64,13 +72,15 @@ has(key: string): boolean; ``` **示例** + ```typescript -import { config } from '@alilc/lowcode-engine'; +import { config } from '@felce/lowcode-engine'; config.has('keyD'); ``` ### setConfig + 批量设值,set 的对象版本 ```typescript @@ -81,14 +91,17 @@ config.has('keyD'); */ setConfig(config: { [key: string]: any }): void; ``` + **示例** + ```typescript -import { config } from '@alilc/lowcode-engine'; +import { config } from '@felce/lowcode-engine'; config.setConfig({ keyA: false, keyB: 2 }); ``` ### getPreference + 获取全局 Preference 管理器,用于管理全局浏览器侧用户 Preference,如 Panel 是否钉住 ```typescript @@ -101,28 +114,29 @@ config.setConfig({ keyA: false, keyB: 2 }); */ getPreference(): IPublicModelPreference; ``` -相关类型:[IPublicModelPreference](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/preference.ts) + +相关类型:[IPublicModelPreference](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/preference.ts) **@since v1.1.0** 示例 ```javascript -import { config } from '@alilc/lowcode-engine'; +import { config } from '@felce/lowcode-engine'; const panelName = 'outline-master-pane'; // 设置大纲树面板钉住,在大纲树下次重新打开时生效 -config.getPreference().set(`${panelName}-pinned-status-isFloat`, false, 'skeleton') +config.getPreference().set(`${panelName}-pinned-status-isFloat`, false, 'skeleton'); ``` ## 事件 ### onceGot + 获取指定 key 的值,若此时还未赋值,则等待,若已有值,则直接返回值 注:此函数返回 Promise 实例 - ```typescript /** * 获取指定 key 的值,若此时还未赋值,则等待,若已有值,则直接返回值 @@ -134,11 +148,13 @@ config.getPreference().set(`${panelName}-pinned-status-isFloat`, false, 'skeleto */ onceGot(key: string): Promise; ``` + **示例** + ```typescript -import { config } from '@alilc/lowcode-engine'; +import { config } from '@felce/lowcode-engine'; -config.onceGot('keyA').then(value => { +config.onceGot('keyA').then((value) => { console.log(`The value of keyA is ${value}`); }); @@ -147,6 +163,7 @@ const value = await config.onceGot('keyA'); ``` ### onGot + 获取指定 key 的值,函数回调模式,若多次被赋值,回调会被多次调用 ```typescript @@ -160,9 +177,11 @@ const value = await config.onceGot('keyA'); */ onGot(key: string, fn: (data: any) => void): () => void; ``` + **示例** + ```typescript -import { config } from '@alilc/lowcode-engine'; +import { config } from '@felce/lowcode-engine'; config.onGot('keyA', (value) => { console.log(`The value of keyA is ${value}`); @@ -170,4 +189,4 @@ config.onGot('keyA', (value) => { const.set('keyA', 1); // 'The value of keyA is 1' const.set('keyA', 2); // 'The value of keyA is 2' -``` \ No newline at end of file +``` diff --git a/docs/docs/api/configOptions.md b/docs/docs/api/configOptions.md index 5d6e8d7abb..6571e6af8b 100644 --- a/docs/docs/api/configOptions.md +++ b/docs/docs/api/configOptions.md @@ -3,14 +3,14 @@ title: config options - 配置列表 sidebar_position: 5 --- -> **@types** [IPublicTypeEngineOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/engine-options.ts)
+> **@types** [IPublicTypeEngineOptions](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/engine-options.ts)
## 配置方式 #### init API ```javascript -import { init } from '@alilc/lowcode-engine'; +import { init } from '@felce/lowcode-engine'; init(document.getElementById('engine'), { enableCondition: false, @@ -22,17 +22,16 @@ init(document.getElementById('engine'), { #### config API ```javascript -import { config } from '@alilc/lowcode-engine'; +import { config } from '@felce/lowcode-engine'; -config.set('enableCondition', false) +config.set('enableCondition', false); ``` [**config api**](./config) ## 配置详情 -> 源码详见 [IPublicTypeEngineOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/engine-options.ts) - +> 源码详见 [IPublicTypeEngineOptions](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/engine-options.ts) ### 画布 @@ -73,7 +72,6 @@ config.set('enableCondition', false) 与 react-renderer 的 appHelper 一致,https://lowcode-engine.cn/site/docs/guide/expand/runtime/renderer#apphelper - #### enableCondition `@type {boolean}` @@ -159,8 +157,8 @@ config.set('enableCondition', false) '.next-calendar-header', '.next-calendar-table', '.editor-container', // 富文本组件 - ] -} + ]; +}; ``` #### enableCanvasLock @@ -197,7 +195,6 @@ config.set('enableCondition', false) 关闭拖拽组件时的虚线响应,性能考虑 - #### disableDefaultSettingPanel `@type {boolean}` `@default {false}` @@ -303,4 +300,3 @@ customPluginTransducer: async (originPlugin: IPublicTypePlugin, ctx: IPublicMode `@type {object}` 大纲树插件面板默认 props - diff --git a/docs/docs/api/event.md b/docs/docs/api/event.md index c2e86f7106..ad60a6cee7 100644 --- a/docs/docs/api/event.md +++ b/docs/docs/api/event.md @@ -3,15 +3,16 @@ title: event - 事件 API sidebar_position: 10 --- -> **@types** [IPublicApiEvent](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/event.ts)
-> **@since** v1.0.0 - +> **@types** [IPublicApiEvent](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/event.ts)
> **@since** v1.0.0 ## 模块简介 + 负责事件处理 API,支持自定义监听事件、触发事件。 ## 方法 + ### on + 监听事件 ```typescript @@ -23,9 +24,11 @@ sidebar_position: 10 */ on(event: string, listener: (...args: any[]) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) + +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### prependListener + 监听事件,会在其他回调函数之前执行 ```typescript @@ -36,9 +39,11 @@ on(event: string, listener: (...args: any[]) => void): IPublicTypeDisposable; */ prependListener(event: string, listener: (...args: any[]) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) + +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### off + 取消监听事件 ```typescript @@ -52,6 +57,7 @@ off(event: string, listener: (...args: any[]) => void): void; ``` ### emit + 触发事件 ```typescript @@ -66,6 +72,7 @@ emit(event: string, ...args: any[]): void; ``` ## 使用示例 + ### 事件触发和监听 ```typescript @@ -80,9 +87,11 @@ event.emit(eventName); ``` ### setter 和 setter/plugin 之间的联动 + 在 A setter 中进行事件注册: + ```typescript -import { event } from '@alilc/lowcode-engine'; +import { event } from '@felce/lowcode-engine'; const SETTER_NAME = 'SetterA'; @@ -90,28 +99,30 @@ class SetterA extends React.Component { componentDidMount() { // 这里由于面板上会有多个 setter,使用 field.id 来标记 setter 名 this.emitEventName = `${SETTER_NAME}-${this.props.field.id}`; - event.on(`common:${this.emitEventName}.bindEvent`, this.bindEvent) + event.on(`common:${this.emitEventName}.bindEvent`, this.bindEvent); } bindEvent = (eventName) => { // do someting - } + }; componentWillUnmount() { - // setter 是以实例为单位的,每个 setter 注销的时候需要把事件也注销掉,避免事件池过多 - event.off(`common:${this.emitEventName}.bindEvent`, this.bindEvent) + // setter 是以实例为单位的,每个 setter 注销的时候需要把事件也注销掉,避免事件池过多 + event.off(`common:${this.emitEventName}.bindEvent`, this.bindEvent); } } ``` + 在 B setter 中触发事件,来完成通信: + ```typescript -import { event } from '@alilc/lowcode-engine'; +import { event } from '@felce/lowcode-engine'; class SetterB extends React.Component { bindFunction = () => { const { field, value } = this.props; // 这里展示的和插件进行通信,事件规则是插件名 + 方法 event.emit('eventBindDialog.openDialog', field.name, this.emitEventName); - } + }; } ``` diff --git a/docs/docs/api/hotkey.md b/docs/docs/api/hotkey.md index be6a3033d0..f8a0bc0aeb 100644 --- a/docs/docs/api/hotkey.md +++ b/docs/docs/api/hotkey.md @@ -1,16 +1,18 @@ --- -title: hotkey - 快捷键 API +title: hotkey - 快捷键 API sidebar_position: 10 --- -> **@types** [IPublicApiHotkey](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/hotkey.ts)
-> **@since** v1.0.0 +> **@types** [IPublicApiHotkey](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/hotkey.ts)
> **@since** v1.0.0 ## 模块简介 + 绑定快捷键 API,可以自定义项目快捷键使用。 ## 方法 + ### bind + 绑定快捷键 ```typescript @@ -28,13 +30,16 @@ bind( action?: string, ): IPublicTypeDisposable; ``` + 相关 types -- [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) +- [IPublicTypeHotkeyCallback](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/hotkey-callback.ts) +- [IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ## 使用示例 + ### 基础示例 + ```typescript hotkey.bind('command+s', (e) => { e.preventDefault(); @@ -43,6 +48,7 @@ hotkey.bind('command+s', (e) => { ``` ### 同时绑定多个快捷键 + ```typescript hotkey.bind(['command+s', 'command+c'], (e) => { e.preventDefault(); @@ -51,10 +57,9 @@ hotkey.bind(['command+s', 'command+c'], (e) => { ``` ### 保存快捷键配置 + ```typescript -import { - hotkey, -} from '@alilc/lowcode-engine'; +import { hotkey } from '@felce/lowcode-engine'; function saveSchema(schema) { // 保存 schema 相关操作 @@ -70,7 +75,7 @@ const saveSampleHotKey = (ctx: IPublicModelPluginContext) => { }); }, }; -} +}; saveSampleHotKey.pluginName = 'saveSampleHotKey'; plugins.register(saveSampleHotKey); diff --git a/docs/docs/api/init.md b/docs/docs/api/init.md index dd84d9c00f..2ee89029bd 100644 --- a/docs/docs/api/init.md +++ b/docs/docs/api/init.md @@ -5,24 +5,28 @@ sidebar_position: 0 > **@since** v1.0.0 - ## 模块简介 + 提供 init 等方法 + ## 方法 + #### init + 初始化引擎 **方法定义** + ```typescript -function init(container?: Element, options?: IPublicTypeEngineOptions): void +function init(container?: Element, options?: IPublicTypeEngineOptions): void; ``` [**初始化引擎配置参数列表**](./configOptions) - ## 使用示例 + ```typescript -import { init } from '@alilc/lowcode-engine'; +import { init } from '@felce/lowcode-engine'; init(document.getElementById('engine'), { enableCondition: false, @@ -30,8 +34,9 @@ init(document.getElementById('engine'), { ``` ### 默认打开移动端画布 + ```typescript -import { init } from '@alilc/lowcode-engine'; +import { init } from '@felce/lowcode-engine'; init({ device: 'mobile', @@ -39,8 +44,9 @@ init({ ``` ### 使用 utils 第三方工具扩展 + ```json -import { init } from '@alilc/lowcode-engine'; +import { init } from '@felce/lowcode-engine'; init({ device: 'mobile', diff --git a/docs/docs/api/logger.md b/docs/docs/api/logger.md index 38d986258b..ce4aa2fea6 100644 --- a/docs/docs/api/logger.md +++ b/docs/docs/api/logger.md @@ -3,12 +3,12 @@ title: logger - 日志 API sidebar_position: 10 --- -> **@types** [IPublicApiLogger](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/logger.ts)
-> **@since** v1.0.0 - +> **@types** [IPublicApiLogger](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/logger.ts)
> **@since** v1.0.0 ## 模块简介 + 引擎日志模块,可以按照 **日志级别 **和** 业务类型 **两个维度来定制日志。 + > 注:日志级别可以通过 url query 动态调整,详见下方[查看示例](#查看示例)。
> 参考 [zen-logger](https://web.npm.alibaba-inc.com/package/zen-logger) 实现进行封装 @@ -46,7 +46,7 @@ log(...args: any | any[]): void; ## 输出示例 ```typescript -import { Logger } from '@alilc/lowcode-utils'; +import { Logger } from '@felce/lowcode-utils'; const logger = new Logger({ level: 'warn', bizName: 'myPlugin:moduleA' }); logger.log('Awesome Low-Code Engine'); ``` @@ -56,7 +56,7 @@ logger.log('Awesome Low-Code Engine'); 开启查看方式: - 方式 1:所有 logger 创建时会有默认输出的 level, 默认为 warn , 即只展示 warn , error -- 方式 2:url 上追加 __logConf__进行开启,示例如下 +- 方式 2:url 上追加 **logConf**进行开启,示例如下 ``` https://lowcode-engine.cn/demo/demo-general/index.html?__logConf__=warn diff --git a/docs/docs/api/material.md b/docs/docs/api/material.md index 0e09441275..4493433499 100644 --- a/docs/docs/api/material.md +++ b/docs/docs/api/material.md @@ -3,16 +3,18 @@ title: material - 物料 API sidebar_position: 10 --- -> **@types** [IPublicApiMaterial](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/material.ts)
-> **@since** v1.0.0 - +> **@types** [IPublicApiMaterial](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/material.ts)
> **@since** v1.0.0 ## 模块简介 + 负责物料相关的 API,包括资产包、设计器辅助层、物料元数据和物料元数据管道函数。 ## 变量 + ### componentsMap + 获取组件 map 结构 + ```typescript /** * 获取组件 map 结构 @@ -20,12 +22,15 @@ sidebar_position: 10 */ get componentsMap(): { [key: string]: IPublicTypeNpmInfo | ComponentType | object } ; ``` -相关类型:[IPublicTypeNpmInfo](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/npm-info.ts) + +相关类型:[IPublicTypeNpmInfo](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/npm-info.ts) ## 方法 ### 资产包 + #### setAssets + 设置「[资产包](/site/docs/specs/lowcode-spec#2-协议结构)」结构 ```typescript @@ -36,42 +41,49 @@ get componentsMap(): { [key: string]: IPublicTypeNpmInfo | ComponentType | */ setAssets(assets: IPublicTypeAssetsJson): void; ``` -相关类型:[IPublicTypeAssetsJson](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/assets-json.ts) +相关类型:[IPublicTypeAssetsJson](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/assets-json.ts) **示例** 直接在项目中引用 npm 包 + ```javascript -import { material } from '@alilc/lowcode-engine'; +import { material } from '@felce/lowcode-engine'; import assets from '@alilc/mc-assets-/assets.json'; material.setAssets(assets); ``` 通过接口动态引入资产包 + ```typescript -import { material, plugins } from '@alilc/lowcode-engine'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { material, plugins } from '@felce/lowcode-engine'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; // 动态加载 assets -plugins.register((ctx: IPublicModelPluginContext) => { - return { - name: 'ext-assets', - async init() { - try { - // 将下述链接替换为您的物料描述地址即可。 - const res = await window.fetch('https://fusion.alicdn.com/assets/default@0.1.95/assets.json'); - const assets = await res.text(); - material.setAssets(assets); - } catch (err) { - console.error(err); - }; - }, - }; -}).catch(err => console.error(err)); +plugins + .register((ctx: IPublicModelPluginContext) => { + return { + name: 'ext-assets', + async init() { + try { + // 将下述链接替换为您的物料描述地址即可。 + const res = await window.fetch( + 'https://fusion.alicdn.com/assets/default@0.1.95/assets.json', + ); + const assets = await res.text(); + material.setAssets(assets); + } catch (err) { + console.error(err); + } + }, + }; + }) + .catch((err) => console.error(err)); ``` #### getAssets + 获取「资产包」结构 ```typescript @@ -82,17 +94,19 @@ plugins.register((ctx: IPublicModelPluginContext) => { */ getAssets(): IPublicTypeAssetsJson; ``` -相关类型:[IPublicTypeAssetsJson](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/assets-json.ts) +相关类型:[IPublicTypeAssetsJson](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/assets-json.ts) **示例** + ```typescript -import { material } from '@alilc/lowcode-engine'; +import { material } from '@felce/lowcode-engine'; material.getAssets(); ``` #### loadIncrementalAssets + 加载增量的「资产包」结构,该增量包会与原有的合并 ```typescript @@ -104,11 +118,13 @@ material.getAssets(); */ loadIncrementalAssets(incrementalAssets: IPublicTypeAssetsJson): Promise; ``` -相关类型:[IPublicTypeAssetsJson](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/assets-json.ts) + +相关类型:[IPublicTypeAssetsJson](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/assets-json.ts) **示例** + ```typescript -import { material } from '@alilc/lowcode-engine'; +import { material } from '@felce/lowcode-engine'; import assets1 from '@alilc/mc-assets-/assets.json'; import assets2 from '@alilc/mc-assets-/assets.json'; @@ -119,20 +135,22 @@ material.loadIncrementalAssets(assets2); 更新特定物料的描述文件 ```typescript -import { material } from '@alilc/lowcode-engine'; +import { material } from '@felce/lowcode-engine'; material.loadIncrementalAssets({ version: '', components: [ - { - "componentName": 'Button', - "props": [{ name: 'new', title: 'new', propType: 'string' }] - } + { + componentName: 'Button', + props: [{ name: 'new', title: 'new', propType: 'string' }], + }, ], -}) +}); ``` ### 设计器辅助层 + #### addBuiltinComponentAction + 在设计器辅助层增加一个扩展 action ```typescript @@ -143,30 +161,33 @@ material.loadIncrementalAssets({ */ addBuiltinComponentAction(action: IPublicTypeComponentAction): void; ``` -相关类型:[IPublicTypeComponentAction](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/component-action.ts) +相关类型:[IPublicTypeComponentAction](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/component-action.ts) **示例** 新增设计扩展位,并绑定事件 + ```typescript -import { material } from '@alilc/lowcode-engine'; +import { material } from '@felce/lowcode-engine'; material.addBuiltinComponentAction({ name: 'myIconName', content: { - icon: () => 'x', - title: 'hover title', - action(node) { - console.log('myIconName 扩展位被点击'); - } + icon: () => 'x', + title: 'hover title', + action(node) { + console.log('myIconName 扩展位被点击'); + }, }, important: true, condition: true, }); ``` + ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01jDbN7B1KfWVzJ16tw_!!6000000001191-2-tps-230-198.png) #### removeBuiltinComponentAction + 移除设计器辅助层的指定 action ```typescript @@ -187,14 +208,15 @@ removeBuiltinComponentAction(name: string): void; - unlock:解锁,可编辑 **示例** + ```typescript -import { material } from '@alilc/lowcode-engine'; +import { material } from '@felce/lowcode-engine'; material.removeBuiltinComponentAction('myIconName'); ``` - #### modifyBuiltinComponentAction + 修改已有的设计器辅助层的指定 action ```typescript @@ -209,8 +231,8 @@ modifyBuiltinComponentAction( handle: (action: IPublicTypeComponentAction) => void, ): void; ``` -相关类型:[IPublicTypeComponentAction](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/component-action.ts) +相关类型:[IPublicTypeComponentAction](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/component-action.ts) ##### 内置设计器辅助 name @@ -220,24 +242,24 @@ modifyBuiltinComponentAction( - lock:锁定,不可编辑 - unlock:解锁,可编辑 - - **示例** 给原始的 remove 扩展时间添加执行前后的日志 + ```typescript -import { material } from '@alilc/lowcode-engine'; +import { material } from '@felce/lowcode-engine'; material.modifyBuiltinComponentAction('remove', (action) => { const originAction = action.content.action; action.content.action = (node) => { - console.log('before reomve!'); + console.log('before reomve!'); originAction(node); console.log('after remove!'); - } + }; }); ``` ### 右键菜单项 + #### addContextMenuOption 添加右键菜单项 @@ -253,7 +275,7 @@ addContextMenuOption(action: IPublicTypeContextMenuAction): void; 示例 ```typescript -import { IPublicEnumContextMenuType } from '@alilc/lowcode-types'; +import { IPublicEnumContextMenuType } from '@felce/lowcode-types'; material.addContextMenuOption({ name: 'parentItem', @@ -309,19 +331,20 @@ adjustContextMenuLayout(fn: (actions: IPublicTypeContextMenuItem[]) => IPublicTy material.adjustContextMenuLayout((actions: IPublicTypeContextMenuAction) => { const names = ['a', 'b']; const newActions = []; - actions.forEach(d => { + actions.forEach((d) => { newActions.push(d); if (names.include(d.name)) { - newActions.push({ type: 'separator' }) + newActions.push({ type: 'separator' }); } }); - return newActions -}) + return newActions; +}); ``` ### 物料元数据 #### getComponentMeta + 获取指定名称的物料元数据 ```typescript @@ -333,11 +356,13 @@ material.adjustContextMenuLayout((actions: IPublicTypeContextMenuAction) => { */ getComponentMeta(componentName: string): IPublicModelComponentMeta | null; ``` -相关类型:[IPublicModelComponentMeta](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts) + +相关类型:[IPublicModelComponentMeta](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts) **示例** + ```typescript -import { material } from '@alilc/lowcode-engine'; +import { material } from '@felce/lowcode-engine'; material.getComponentMeta('Input'); ``` @@ -354,11 +379,13 @@ material.getComponentMeta('Input'); */ getComponentMetasMap(): Map; ``` -相关类型:[IPublicModelComponentMeta](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts) + +相关类型:[IPublicModelComponentMeta](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts) **示例** + ```typescript -import { material } from '@alilc/lowcode-engine'; +import { material } from '@felce/lowcode-engine'; material.getComponentMetasMap(); ``` @@ -374,7 +401,9 @@ material.getComponentMetasMap(); ``` ### 物料元数据管道函数 + #### registerMetadataTransducer + 注册物料元数据管道函数,在物料信息初始化时执行。 ```typescript @@ -395,8 +424,9 @@ registerMetadataTransducer( **示例** 给每一个组件的配置添加高级配置面板,其中有一个是否渲染配置项 + ```typescript -import { material } from '@alilc/lowcode-engine' +import { material } from '@felce/lowcode-engine'; function addonCombine(metadata: TransformedComponentMetadata) { const { componentName, configure = {} } = metadata; @@ -441,29 +471,34 @@ material.registerMetadataTransducer(addonCombine, 1, 'parse-func'); 删除高级 Tab ```typescript -import { material } from '@alilc/lowcode-engine'; -import { IPublicTypeFieldConfig } from '@alilc/lowcode-types'; +import { material } from '@felce/lowcode-engine'; +import { IPublicTypeFieldConfig } from '@felce/lowcode-types'; -material.registerMetadataTransducer((transducer) => { - const combined: IPublicTypeFieldConfig[] = []; +material.registerMetadataTransducer( + (transducer) => { + const combined: IPublicTypeFieldConfig[] = []; - transducer.configure.combined?.forEach(d => { - if (d.name !== '#advanced') { - combined.push(d); - } - }); + transducer.configure.combined?.forEach((d) => { + if (d.name !== '#advanced') { + combined.push(d); + } + }); - return { - ...transducer, - configure: { - ...transducer.configure, - combined, - } - }; -}, 111, 'parse-func'); + return { + ...transducer, + configure: { + ...transducer.configure, + combined, + }, + }; + }, + 111, + 'parse-func', +); ``` #### getRegisteredMetadataTransducers + 获取所有物料元数据管道函数 ```typescript @@ -476,13 +511,17 @@ getRegisteredMetadataTransducers(): IPublicTypeMetadataTransducer[]; ``` **示例** + ```typescript -import { material } from '@alilc/lowcode-engine' +import { material } from '@felce/lowcode-engine'; material.getRegisteredMetadataTransducers(); ``` + ## 事件 + ### onChangeAssets + 监听 assets 变化的事件 ```typescript @@ -494,11 +533,12 @@ material.getRegisteredMetadataTransducers(); onChangeAssets(fn: () => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) **示例** + ```typescript -import { material } from '@alilc/lowcode-engine'; +import { material } from '@felce/lowcode-engine'; material.onChangeAssets(() => { console.log('asset changed'); diff --git a/docs/docs/api/model/clipboard.md b/docs/docs/api/model/clipboard.md index 15d9e280ca..190c92f39b 100644 --- a/docs/docs/api/model/clipboard.md +++ b/docs/docs/api/model/clipboard.md @@ -3,8 +3,7 @@ title: Clipboard sidebar_position: 14 --- -> **@types** [IPublicModelClipboard](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/clipboard.ts)
-> **@since** v1.1.0 +> **@types** [IPublicModelClipboard](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/clipboard.ts)
> **@since** v1.1.0 ## 方法 @@ -40,4 +39,4 @@ waitPasteData( keyboardEvent: KeyboardEvent, cb: (data: any, clipboardEvent: ClipboardEvent) => void, ): void; -``` \ No newline at end of file +``` diff --git a/docs/docs/api/model/component-meta.md b/docs/docs/api/model/component-meta.md index 28f7fe7407..33f3ff1dc9 100644 --- a/docs/docs/api/model/component-meta.md +++ b/docs/docs/api/model/component-meta.md @@ -3,8 +3,7 @@ title: ComponentMeta sidebar_position: 15 --- -> **@types** [IPublicModelComponentMeta](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts)
-> **@since** v1.0.0 +> **@types** [IPublicModelComponentMeta](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts)
> **@since** v1.0.0 ## 基本介绍 @@ -25,9 +24,11 @@ sidebar_position: 15 `@type {boolean}` ### isMinimalRenderUnit + 是否是最小渲染单元 当组件需要重新渲染时: + - 若为最小渲染单元,则只渲染当前组件, - 若不为最小渲染单元,则寻找到上层最近的最小渲染单元进行重新渲染,直至根节点。 @@ -45,7 +46,7 @@ sidebar_position: 15 `@type {IPublicTypeFieldConfig[]}` -相关类型:[IPublicTypeFieldConfig](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/field-config.ts) +相关类型:[IPublicTypeFieldConfig](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/field-config.ts) ### title @@ -53,7 +54,7 @@ sidebar_position: 15 `@type {string | IPublicTypeI18nData | ReactElement}` -相关类型:[IPublicTypeI18nData](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/i18n-data.ts) +相关类型:[IPublicTypeI18nData](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/i18n-data.ts) ### icon @@ -61,7 +62,7 @@ sidebar_position: 15 `@type {IPublicTypeIconType}` -相关类型:[IPublicTypeIconType](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/icon-type.ts) +相关类型:[IPublicTypeIconType](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/icon-type.ts) ### npm @@ -69,7 +70,7 @@ sidebar_position: 15 `@type {IPublicTypeNpmInfo}` -相关类型:[IPublicTypeNpmInfo](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/npm-info.ts) +相关类型:[IPublicTypeNpmInfo](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/npm-info.ts) ### availableActions @@ -77,7 +78,7 @@ sidebar_position: 15 `@type {IPublicTypeTransformedComponentMetadata}` -相关类型:[IPublicTypeTransformedComponentMetadata](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/transformed-component-metadata.ts) +相关类型:[IPublicTypeTransformedComponentMetadata](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/transformed-component-metadata.ts) ### advanced @@ -85,7 +86,7 @@ sidebar_position: 15 `@type {IPublicTypeAdvanced}` -相关类型:[IPublicTypeAdvanced](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/advanced.ts) +相关类型:[IPublicTypeAdvanced](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/advanced.ts) ## 方法 @@ -102,7 +103,7 @@ sidebar_position: 15 setNpm(npm: IPublicTypeNpmInfo): void; ``` -相关类型:[IPublicTypeNpmInfo](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/npm-info.ts) +相关类型:[IPublicTypeNpmInfo](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/npm-info.ts) ### getMetadata @@ -116,7 +117,7 @@ setNpm(npm: IPublicTypeNpmInfo): void; getMetadata(): IPublicTypeTransformedComponentMetadata; ``` -相关类型:[IPublicTypeTransformedComponentMetadata](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/transformed-component-metadata.ts) +相关类型:[IPublicTypeTransformedComponentMetadata](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/transformed-component-metadata.ts) ### checkNestingUp @@ -133,9 +134,9 @@ checkNestingUp(my: IPublicModelNode | IPublicTypeNodeData, parent: any): boolean ``` 相关类型: -- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) -- [IPublicTypeNodeData](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-data.ts) +- [IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +- [IPublicTypeNodeData](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/node-data.ts) ### checkNestingDown @@ -155,10 +156,10 @@ checkNestingDown( ``` 相关类型: -- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) -- [IPublicTypeNodeData](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-data.ts) -- [IPublicTypeNodeSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) +- [IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +- [IPublicTypeNodeData](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/node-data.ts) +- [IPublicTypeNodeSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) ### refreshMetadata diff --git a/docs/docs/api/model/detecting.md b/docs/docs/api/model/detecting.md index ccd60e3a65..5155ee6ac8 100644 --- a/docs/docs/api/model/detecting.md +++ b/docs/docs/api/model/detecting.md @@ -2,8 +2,8 @@ title: Detecting sidebar_position: 6 --- -> **@types** [IPublicModelDetecting](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/detecting.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicModelDetecting](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/detecting.ts)
> **@since** v1.0.0 ## 基本介绍 @@ -17,7 +17,7 @@ sidebar_position: 6 `@type {IPublicModelNode | null}` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) **@since v1.0.16** @@ -27,8 +27,8 @@ sidebar_position: 6 `@type {boolean}` - ## 方法 + ### capture hover 指定节点 @@ -68,7 +68,9 @@ leave(): void; ``` ## 事件 + ### onDetectingChange + hover 节点变化事件 ```typescript @@ -81,7 +83,8 @@ onDetectingChange(fn: (node: IPublicModelNode | null) => void): IPublicTypeDispo ``` 相关类型: -- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) -- [IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) -**@since v1.1.0** \ No newline at end of file +- [IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +- [IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) + +**@since v1.1.0** diff --git a/docs/docs/api/model/document-model.md b/docs/docs/api/model/document-model.md index 8d813e7678..4c81ba8020 100644 --- a/docs/docs/api/model/document-model.md +++ b/docs/docs/api/model/document-model.md @@ -2,8 +2,8 @@ title: DocumentModel sidebar_position: 0 --- -> **@types** [IPublicModelDocumentModel](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/document-model.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicModelDocumentModel](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/document-model.ts)
> **@since** v1.0.0 ## 基本介绍 @@ -25,7 +25,7 @@ sidebar_position: 0 相关章节:[节点选中区模型](./selection) -相关类型:[IPublicModelSelection](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/selection.ts) +相关类型:[IPublicModelSelection](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/selection.ts) ### detecting @@ -35,7 +35,7 @@ sidebar_position: 0 相关章节:[画布节点悬停模型](./detecting) -相关类型:[IPublicModelDetecting](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/detecting.ts) +相关类型:[IPublicModelDetecting](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/detecting.ts) ### history @@ -45,7 +45,7 @@ sidebar_position: 0 相关章节:[操作历史模型](./history) -相关类型:[IPublicModelHistory](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/history.ts) +相关类型:[IPublicModelHistory](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/history.ts) ### project @@ -53,7 +53,7 @@ sidebar_position: 0 `@type {IPublicApiProject}` -相关类型:[IPublicApiProject](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/project.ts) +相关类型:[IPublicApiProject](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/project.ts) ### root @@ -61,7 +61,7 @@ sidebar_position: 0 `@type {IPublicModelNode | null}` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### nodesMap @@ -69,10 +69,9 @@ sidebar_position: 0 `@type {Map} ` - 相关章节:[节点模型](./node) -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### modalNodesManager @@ -82,7 +81,7 @@ sidebar_position: 0 相关章节:[模态节点管理](./modal-nodes-manager) -相关类型:[IPublicModelModalNodesManager](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/modal-nodes-manager.ts) +相关类型:[IPublicModelModalNodesManager](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/modal-nodes-manager.ts) ### dropLocation @@ -90,12 +89,12 @@ sidebar_position: 0 `@type {IPublicModelDropLocation | null}` - -相关类型:[IPublicModelDropLocation](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/drop-location.ts) +相关类型:[IPublicModelDropLocation](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/drop-location.ts) **@since v1.1.0** ## 方法 + ### getNodeById 根据 nodeId 返回 [Node](./node) 实例 @@ -110,8 +109,7 @@ sidebar_position: 0 getNodeById(nodeId: string): IPublicModelNode | null; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) - +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### importSchema @@ -126,10 +124,10 @@ getNodeById(nodeId: string): IPublicModelNode | null; importSchema(schema: IPublicTypeRootSchema): void; ``` -相关类型:[IPublicTypeRootSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/root-schema.ts) - +相关类型:[IPublicTypeRootSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/root-schema.ts) ### exportSchema + 导出 schema ```typescript @@ -143,8 +141,9 @@ exportSchema(stage: IPublicEnumTransformStage): IPublicTypeRootSchema | undefine ``` 相关类型: -- [IPublicEnumTransformStage](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/enum/transform-stage.ts) -- [IPublicTypeRootSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/root-schema.ts) + +- [IPublicEnumTransformStage](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/enum/transform-stage.ts) +- [IPublicTypeRootSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/root-schema.ts) ### insertNode @@ -163,7 +162,7 @@ insertNode( ): IPublicModelNode | null; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### createNode @@ -179,7 +178,7 @@ insertNode( createNode(data: any): IPublicModelNode | null; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### removeNode @@ -194,9 +193,10 @@ createNode(data: any): IPublicModelNode | null; removeNode(idOrNode: string | IPublicModelNode): void; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### checkNesting + 检查拖拽放置的目标节点是否可以放置该拖拽对象 ```typescript @@ -215,13 +215,15 @@ checkNesting( ``` 相关类型: -- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) -- [IPublicTypeDragNodeObject](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/drag-node-object.ts) -- [IPublicTypeDragNodeDataObject](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/drag-node-object-data.ts) + +- [IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +- [IPublicTypeDragNodeObject](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/drag-node-object.ts) +- [IPublicTypeDragNodeDataObject](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/drag-node-object-data.ts) **@since v1.0.16** ### isDetectingNode + 判断是否当前节点处于被探测状态 ```typescript @@ -233,13 +235,13 @@ checkNesting( */ isDetectingNode(node: IPublicModelNode): boolean; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) **@since v1.1.0** - ## 事件 + ### onAddNode 当前 document 新增节点事件 @@ -253,8 +255,9 @@ onAddNode(fn: (node: IPublicModelNode) => void): IPublicTypeDisposable; ``` 相关类型: -- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) -- [IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) + +- [IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +- [IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onMountNode @@ -269,10 +272,12 @@ onMountNode(fn: (payload: { node: IPublicModelNode }) => void): IPublicTypeDispo ``` 相关类型: -- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) -- [IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) + +- [IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +- [IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onRemoveNode + 当前 document 删除节点事件 ```typescript @@ -284,9 +289,9 @@ onRemoveNode(fn: (node: IPublicModelNode) => void): IPublicTypeDisposable; ``` 相关类型: -- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) -- [IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +- [IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +- [IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onChangeDetecting @@ -302,8 +307,9 @@ onChangeDetecting(fn: (node: IPublicModelNode) => void): IPublicTypeDisposable; ``` 相关类型: -- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) -- [IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) + +- [IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +- [IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onChangeSelection @@ -317,7 +323,7 @@ onChangeDetecting(fn: (node: IPublicModelNode) => void): IPublicTypeDisposable; onChangeSelection(fn: (ids: string[]) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onChangeNodeVisible @@ -332,8 +338,8 @@ onChangeSelection(fn: (ids: string[]) => void): IPublicTypeDisposable; onChangeNodeVisible(fn: (node: IPublicModelNode, visible: boolean) => void): IPublicTypeDisposable; ``` -- 相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) -- 相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +- 相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +- 相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onChangeNodeChildren @@ -343,19 +349,22 @@ onChangeNodeVisible(fn: (node: IPublicModelNode, visible: boolean) => void): IPu onChangeNodeChildren(fn: (info?: IPublicTypeOnChangeOptions) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onChangeNodeProp + 当前 document 节点属性修改事件 ```typescript onChangeNodeProp(fn: (info: IPublicTypePropChangeOptions) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onImportSchema + 当前 document 导入新的 schema 事件 + ```typescript /** * import schema event @@ -364,13 +373,16 @@ onChangeNodeProp(fn: (info: IPublicTypePropChangeOptions) => void): IPublicTypeD */ onImportSchema(fn: (schema: IPublicTypeRootSchema) => void): IPublicTypeDisposable; ``` + 相关类型: -- [IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) -- [IPublicTypeRootSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/root-schema.ts) + +- [IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +- [IPublicTypeRootSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/root-schema.ts) **@since v1.0.15** ### onFocusNodeChanged + 设置聚焦节点变化的回调 ```typescript @@ -384,13 +396,16 @@ onFocusNodeChanged( fn: (doc: IPublicModelDocumentModel, focusNode: IPublicModelNode) => void, ): IPublicTypeDisposable; ``` + 相关类型: -- [IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) -- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) + +- [IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +- [IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) **@since v1.1.0** ### onDropLocationChanged + 设置 DropLocation 变化的回调 ```typescript @@ -403,6 +418,6 @@ onFocusNodeChanged( onDropLocationChanged(fn: (doc: IPublicModelDocumentModel) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) -**@since v1.1.0** \ No newline at end of file +**@since v1.1.0** diff --git a/docs/docs/api/model/dragon.md b/docs/docs/api/model/dragon.md index c6feca4329..e1de1505d9 100644 --- a/docs/docs/api/model/dragon.md +++ b/docs/docs/api/model/dragon.md @@ -2,16 +2,17 @@ title: Dragon sidebar_position: 99 --- -> **@types** [IPublicModelDragon](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/dragon.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicModelDragon](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/dragon.ts)
> **@since** v1.0.0 ## 基本介绍 拖拽对象 ### 对应接口 + ```typescript -import { IPublicModelDragon } from '@alilc/lowcode-types'; +import { IPublicModelDragon } from '@felce/lowcode-types'; ``` ### 支持版本 @@ -50,6 +51,7 @@ onDragstart(func: (e: IPublicModelLocateEvent) => any): () => void; ### onDrag 绑定 drag 事件 + ```typescript /** * 绑定 drag 事件 @@ -93,6 +95,7 @@ from(shell: Element, boost: (e: MouseEvent) => IPublicTypeDragNodeDataObject | n ### boost 发射拖拽对象 + ```typescript /** * 发射拖拽对象 @@ -126,4 +129,4 @@ addSensor(sensor: any): void; * remove sensor area */ removeSensor(sensor: any): void; -``` \ No newline at end of file +``` diff --git a/docs/docs/api/model/drop-location.md b/docs/docs/api/model/drop-location.md index dc6a684e42..c7355ac509 100644 --- a/docs/docs/api/model/drop-location.md +++ b/docs/docs/api/model/drop-location.md @@ -3,9 +3,7 @@ title: DropLocation sidebar_position: 13 --- -> **@types** [IPublicModelDropLocation](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/drop-location.ts)
-> **@since** v1.1.0 - +> **@types** [IPublicModelDropLocation](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/drop-location.ts)
> **@since** v1.1.0 ## 基本介绍 @@ -19,7 +17,7 @@ sidebar_position: 13 `@type {IPublicModelNode | null}` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### detail @@ -27,7 +25,7 @@ sidebar_position: 13 `@type {IPublicTypeLocationDetail}` -相关类型:[IPublicTypeLocationDetail](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/location-detail.ts) +相关类型:[IPublicTypeLocationDetail](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/location-detail.ts) ### event @@ -35,7 +33,7 @@ sidebar_position: 13 `@type {IPublicTypeLocationDetail}` -相关类型:[IPublicModelLocateEvent](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/location-event.ts) +相关类型:[IPublicModelLocateEvent](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/location-event.ts) ## 方法 @@ -51,4 +49,4 @@ sidebar_position: 13 clone(event: IPublicModelLocateEvent): IPublicModelDropLocation; ``` -相关类型:[IPublicModelLocateEvent](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/location-event.ts) \ No newline at end of file +相关类型:[IPublicModelLocateEvent](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/location-event.ts) diff --git a/docs/docs/api/model/editor-view.md b/docs/docs/api/model/editor-view.md index a3cc83e1f2..63938ebfac 100644 --- a/docs/docs/api/model/editor-view.md +++ b/docs/docs/api/model/editor-view.md @@ -3,9 +3,7 @@ title: EditorView sidebar_position: 12 --- -> **[@experimental](./#experimental)**
-> **@types** [IPublicModelEditorView](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/editor-view.ts)
-> **@since** v1.1.7 +> **[@experimental](./#experimental)**
> **@types** [IPublicModelEditorView](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/editor-view.ts)
> **@since** v1.1.7 窗口编辑视图 @@ -18,4 +16,4 @@ export interface IPublicModelEditorView extends IPublicModelPluginContext {}; ``` -相关类型定义: [IPublicModelPluginContext](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/plugin-context.ts) +相关类型定义: [IPublicModelPluginContext](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/plugin-context.ts) diff --git a/docs/docs/api/model/history.md b/docs/docs/api/model/history.md index b8c4d791b1..4e495862c5 100644 --- a/docs/docs/api/model/history.md +++ b/docs/docs/api/model/history.md @@ -2,14 +2,15 @@ title: History sidebar_position: 5 --- -> **@types** [IPublicModelHistory](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/history.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicModelHistory](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/history.ts)
> **@since** v1.0.0 ## 基本介绍 操作历史记录模型 ## 方法 + ### go 历史记录跳转到指定位置 @@ -93,6 +94,7 @@ getState(): number; ``` ## 事件 + ### onChangeState 监听 state 变更事件 @@ -106,7 +108,7 @@ getState(): number; onChangeState(func: () => any): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onChangeCursor @@ -121,4 +123,4 @@ onChangeState(func: () => any): IPublicTypeDisposable; onChangeCursor(func: () => any): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) \ No newline at end of file +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) diff --git a/docs/docs/api/model/modal-nodes-manager.md b/docs/docs/api/model/modal-nodes-manager.md index fead53f0a1..0e3f163f3d 100644 --- a/docs/docs/api/model/modal-nodes-manager.md +++ b/docs/docs/api/model/modal-nodes-manager.md @@ -2,8 +2,8 @@ title: ModalNodesManager sidebar_position: 7 --- -> **@types** [IPublicModelModalNodesManager](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/modal-nodes-manager.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicModelModalNodesManager](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/modal-nodes-manager.ts)
> **@since** v1.0.0 ## 基本介绍 @@ -35,7 +35,7 @@ setNodes(): void; getModalNodes(): IPublicModelNode[]; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### getVisibleModalNode @@ -49,7 +49,7 @@ getModalNodes(): IPublicModelNode[]; getVisibleModalNode(): IPublicModelNode | null; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### hideModalNodes @@ -76,7 +76,7 @@ hideModalNodes(): void; setVisible(node: IPublicModelNode): void; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### setInvisible @@ -91,4 +91,4 @@ setVisible(node: IPublicModelNode): void; setInvisible(node: IPublicModelNode): void; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) diff --git a/docs/docs/api/model/node-children.md b/docs/docs/api/model/node-children.md index 5507fcbfb8..3bfe93279d 100644 --- a/docs/docs/api/model/node-children.md +++ b/docs/docs/api/model/node-children.md @@ -2,20 +2,22 @@ title: NodeChildren sidebar_position: 2 --- -> **@types** [IPublicModelNodeChildren](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node-children.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicModelNodeChildren](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node-children.ts)
> **@since** v1.0.0 ## 基本介绍 + 节点孩子模型 ## 属性 + ### owner 返回当前 children 实例所属的节点实例 `@type {IPublicModelNode | null}` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### size @@ -23,7 +25,6 @@ children 内的节点实例数 `@type {number}` - ### isEmptyNode 是否为空 @@ -31,6 +32,7 @@ children 内的节点实例数 `@type {boolean}` **@since v1.1.0** + > v1.1.0 之前请使用 `isEmpty` ### notEmptyNode @@ -42,7 +44,9 @@ children 内的节点实例数 **@since v1.1.0** ## 方法 + ### delete + 删除指定节点 ```typescript @@ -54,7 +58,7 @@ children 内的节点实例数 delete(node: IPublicModelNode): boolean; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### insert @@ -69,8 +73,7 @@ delete(node: IPublicModelNode): boolean; insert(node: IPublicModelNode): boolean; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) - +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### indexOf @@ -86,7 +89,7 @@ insert(node: IPublicModelNode): boolean; indexOf(node: IPublicModelNode): number; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### splice @@ -103,8 +106,7 @@ indexOf(node: IPublicModelNode): number; splice(start: number, deleteCount: number, node?: IPublicModelNode): any; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) - +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### get @@ -120,8 +122,7 @@ splice(start: number, deleteCount: number, node?: IPublicModelNode): any; get(index: number): IPublicModelNode | null; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) - +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### has @@ -137,8 +138,7 @@ get(index: number): IPublicModelNode | null; has(node: IPublicModelNode): boolean; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) - +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### forEach @@ -154,7 +154,7 @@ forEach(fn: (node: IPublicModelNode, index: number) => void): void; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### reverse @@ -169,8 +169,7 @@ reverse(): IPublicModelNode[]; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) - +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### map @@ -185,8 +184,7 @@ reverse(): IPublicModelNode[]; map(fn: (node: IPublicModelNode, index: number) => T[]): any[] | null; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) - +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### every @@ -201,8 +199,7 @@ map(fn: (node: IPublicModelNode, index: number) => T[]): any[] | null; every(fn: (node: IPublicModelNode, index: number) => boolean): boolean; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) - +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### some @@ -217,8 +214,7 @@ every(fn: (node: IPublicModelNode, index: number) => boolean): boolean; some(fn: (node: IPublicModelNode, index: number) => boolean): boolean; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) - +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### filter @@ -233,8 +229,7 @@ some(fn: (node: IPublicModelNode, index: number) => boolean): boolean; filter(fn: (node: IPublicModelNode, index: number) => boolean): any; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) - +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### find @@ -249,8 +244,7 @@ filter(fn: (node: IPublicModelNode, index: number) => boolean): any; find(fn: (node: IPublicModelNode, index: number) => boolean): IPublicModelNode | null; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) - +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### reduce @@ -265,8 +259,7 @@ find(fn: (node: IPublicModelNode, index: number) => boolean): IPublicModelNode | reduce(fn: (acc: any, cur: IPublicModelNode) => any, initialValue: any): void; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) - +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### importSchema @@ -281,10 +274,10 @@ reduce(fn: (acc: any, cur: IPublicModelNode) => any, initialValue: any): void; importSchema(data?: IPublicTypeNodeData | IPublicTypeNodeData[]): void; ``` -相关类型:[IPublicTypeNodeData](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-data.ts) - +相关类型:[IPublicTypeNodeData](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/node-data.ts) ### exportSchema + 导出 schema ```typescript @@ -297,9 +290,9 @@ exportSchema(stage: IPublicEnumTransformStage): IPublicTypeNodeSchema; ``` 相关类型: -- [IPublicEnumTransformStage](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/enum/transform-stage.ts) -- [IPublicTypeNodeSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) +- [IPublicEnumTransformStage](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/enum/transform-stage.ts) +- [IPublicTypeNodeSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) ### mergeChildren @@ -321,5 +314,6 @@ mergeChildren( ``` 相关类型: -- [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) -- [IPublicTypeNodeData](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-data.ts) + +- [IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +- [IPublicTypeNodeData](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/node-data.ts) diff --git a/docs/docs/api/model/node.md b/docs/docs/api/model/node.md index 43de96a33d..64576532d7 100644 --- a/docs/docs/api/model/node.md +++ b/docs/docs/api/model/node.md @@ -2,14 +2,15 @@ title: Node sidebar_position: 1 --- -> **@types** [IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts)
> **@since** v1.0.0 ## 基本介绍 节点模型 ## 属性 + ### id 节点 id @@ -22,7 +23,7 @@ sidebar_position: 1 `@type {string | IPublicTypeI18nData | ReactElement}` -相关类型:[IPublicTypeI18nData](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/i18n-data.ts) +相关类型:[IPublicTypeI18nData](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/i18n-data.ts) ### isContainerNode @@ -31,6 +32,7 @@ sidebar_position: 1 `@type {boolean}` **@since v1.1.0** + > v1.1.0 之前请使用 `isContainer` ### isRootNode @@ -120,6 +122,7 @@ sidebar_position: 1 **@since v1.0.16** ### isRGLContainerNode + 设置为磁贴布局节点,使用方式可参考:[磁贴布局在钉钉宜搭报表设计引擎中的实现](https://mp.weixin.qq.com/s/PSTut5ahAB8nlJ9kBpBaxw) `@type {boolean}` @@ -140,7 +143,7 @@ sidebar_position: 1 `@type {IPublicTypeIconType}` -相关类型:[IPublicTypeIconType](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/icon-type.ts) +相关类型:[IPublicTypeIconType](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/icon-type.ts) ### zLevel @@ -160,8 +163,7 @@ sidebar_position: 1 `@type {IPublicModelComponentMeta | null}` -相关类型:[IPublicModelComponentMeta](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts) - +相关类型:[IPublicModelComponentMeta](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts) ### document @@ -169,7 +171,7 @@ sidebar_position: 1 `@type {IPublicModelDocumentModel | null}` -相关类型:[IPublicModelDocumentModel](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/document-model.ts) +相关类型:[IPublicModelDocumentModel](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/document-model.ts) ### prevSibling @@ -195,7 +197,7 @@ sidebar_position: 1 `@type {IPublicModelNodeChildren | null}` -相关类型:[IPublicModelNodeChildren](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node-children.ts) +相关类型:[IPublicModelNodeChildren](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node-children.ts) ### slots @@ -209,7 +211,7 @@ sidebar_position: 1 `@type {IPublicModelProp | null}` -相关类型:[IPublicModelProp](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/prop.ts) +相关类型:[IPublicModelProp](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/prop.ts) ### props @@ -217,8 +219,7 @@ sidebar_position: 1 `@type {IPublicModelProps | null}` -相关类型:[IPublicModelProps](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/props.ts) - +相关类型:[IPublicModelProps](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/props.ts) ### propsData @@ -227,8 +228,9 @@ sidebar_position: 1 `@type {IPublicTypePropsMap | IPublicTypePropsList | null}` 相关类型: -- [IPublicTypePropsMap](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/props-map.ts) -- [IPublicTypePropsList](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/props-list.ts) + +- [IPublicTypePropsMap](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/props-map.ts) +- [IPublicTypePropsList](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/props-list.ts) ### conditionGroup @@ -236,7 +238,7 @@ sidebar_position: 1 `@type {IPublicModelExclusiveGroup | null}` -相关类型:[IPublicModelExclusiveGroup](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/exclusive-group.ts) +相关类型:[IPublicModelExclusiveGroup](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/exclusive-group.ts) **@since v1.1.0** @@ -246,7 +248,7 @@ sidebar_position: 1 `@type {IPublicTypeNodeSchema | null}` -相关类型:[IPublicTypeNodeSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) +相关类型:[IPublicTypeNodeSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) ### settingEntry @@ -256,9 +258,10 @@ sidebar_position: 1 相关章节:[设置器顶层操作对象](./setting-top-entry) -相关类型:[IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts) +相关类型:[IPublicModelSettingTopEntry](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts) ### visible + 当前节点是否可见 `@type {boolean}` @@ -328,7 +331,7 @@ hasLoop(): boolean; getProp(path: string, createIfNone: boolean): IPublicModelProp | null; ``` -相关类型:[IPublicModelProp](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/prop.ts) +相关类型:[IPublicModelProp](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/prop.ts) ### getPropValue @@ -360,7 +363,7 @@ getPropValue(path: string): any; getExtraProp(path: string, createIfNone?: boolean): IPublicModelProp | null; ``` -相关类型:[IPublicModelProp](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/prop.ts) +相关类型:[IPublicModelProp](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/prop.ts) ### getExtraPropValue @@ -395,8 +398,7 @@ setPropValue(path: string, value: CompositeValue) setPropValue(path: string, value: IPublicTypeCompositeValue): void; ``` -相关类型:[IPublicTypeCompositeValue](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) - +相关类型:[IPublicTypeCompositeValue](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) ### setExtraPropValue @@ -412,7 +414,7 @@ setPropValue(path: string, value: IPublicTypeCompositeValue): void; setExtraPropValue(path: string, value: IPublicTypeCompositeValue): void; ``` -相关类型:[IPublicTypeCompositeValue](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) +相关类型:[IPublicTypeCompositeValue](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) ### importSchema @@ -427,7 +429,7 @@ setExtraPropValue(path: string, value: IPublicTypeCompositeValue): void; importSchema(data: IPublicTypeNodeSchema): void; ``` -相关类型:[IPublicTypeNodeSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) +相关类型:[IPublicTypeNodeSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) ### exportSchema @@ -444,8 +446,9 @@ exportSchema(stage: IPublicEnumTransformStage, options?: any): IPublicTypeNodeSc ``` 相关类型: -- [IPublicEnumTransformStage](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/enum/transform-stage.ts) -- [IPublicTypeNodeSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) + +- [IPublicEnumTransformStage](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/enum/transform-stage.ts) +- [IPublicTypeNodeSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) ### insertBefore @@ -513,7 +516,7 @@ replaceChild(node: IPublicModelNode, data: any): IPublicModelNode | null; replaceWith(schema: IPublicTypeNodeSchema): any; ``` -相关类型:[IPublicTypeNodeSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) +相关类型:[IPublicTypeNodeSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) ### select @@ -541,6 +544,7 @@ hover(flag: boolean): void; ``` ### lock + 设置节点锁定状态 ```typescript @@ -635,6 +639,7 @@ isConditionalVisible(): boolean | undefined; **@since v1.1.0** ### setConditionalVisible + 设置该节点的 ConditionalVisible 为 true ```typescript @@ -649,6 +654,7 @@ setConditionalVisible(): void; **@since v1.1.0** ### getDOMNode + 获取节点实例对应的 dom 节点 ```typescript @@ -675,4 +681,4 @@ getRGL(): { isRGL: boolean; rglNode: IPublicModelNode | null; } -``` \ No newline at end of file +``` diff --git a/docs/docs/api/model/plugin-instance.md b/docs/docs/api/model/plugin-instance.md index 14ce388376..52d43e6b8b 100644 --- a/docs/docs/api/model/plugin-instance.md +++ b/docs/docs/api/model/plugin-instance.md @@ -3,9 +3,7 @@ title: PluginInstance sidebar_position: 12 --- -> **@types** [IPublicModelPluginInstance](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/plugin-instance.ts)
-> **@since** v1.1.0 - +> **@types** [IPublicModelPluginInstance](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/plugin-instance.ts)
> **@since** v1.1.0 ## 基本介绍 @@ -37,4 +35,4 @@ sidebar_position: 12 `@type {IPublicTypePluginMeta}` -相关类型:[IPublicTypePluginMeta](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/plugin-meta.ts) +相关类型:[IPublicTypePluginMeta](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/plugin-meta.ts) diff --git a/docs/docs/api/model/prop.md b/docs/docs/api/model/prop.md index d9b0d14f42..ebc064f5e3 100644 --- a/docs/docs/api/model/prop.md +++ b/docs/docs/api/model/prop.md @@ -2,8 +2,8 @@ title: Prop sidebar_position: 3 --- -> **@types** [IPublicModelProp](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/prop.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicModelProp](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/prop.ts)
> **@since** v1.0.0 ## 基本介绍 @@ -35,7 +35,7 @@ key 值 `@type {IPublicModelNode | null}` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### slotNode @@ -43,8 +43,7 @@ key 值 `@type {IPublicModelNode | undefined | null}` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) - +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ## 方法 @@ -61,7 +60,7 @@ key 值 setValue(val: IPublicTypeCompositeValue): void; ``` -相关类型:[IPublicTypeCompositeValue](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) +相关类型:[IPublicTypeCompositeValue](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) ### getValue @@ -104,5 +103,6 @@ exportSchema(stage: IPublicEnumTransformStage): IPublicTypeCompositeValue; ``` 相关类型: -- [IPublicEnumTransformStage](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/enum/transform-stage.ts) -- [IPublicTypeCompositeValue](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) \ No newline at end of file + +- [IPublicEnumTransformStage](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/enum/transform-stage.ts) +- [IPublicTypeCompositeValue](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) diff --git a/docs/docs/api/model/props.md b/docs/docs/api/model/props.md index 9bd6eaa66b..03db08ee57 100644 --- a/docs/docs/api/model/props.md +++ b/docs/docs/api/model/props.md @@ -2,37 +2,37 @@ title: Props sidebar_position: 4 --- -> **@types** [IPublicModelProps](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/props.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicModelProps](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/props.ts)
> **@since** v1.0.0 ## 基本介绍 属性集模型 ## 属性 + ### id id `@type {string}` - ### path 返回当前 props 的路径 `@type {string[]}` - ### node 返回当前属性集所属的节点实例 `@type {IPublicModelNode | null}` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ## 方法 + ### getProp 获取指定 path 的属性模型实例 @@ -46,7 +46,7 @@ id getProp(path: string): IPublicModelProp | null; ``` -相关类型:[IPublicModelProp](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/prop.ts) +相关类型:[IPublicModelProp](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/prop.ts) ### getPropValue @@ -75,7 +75,7 @@ getPropValue(path: string): any; getExtraProp(path: string): IPublicModelProp | null; ``` -相关类型:[IPublicModelProp](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/prop.ts) +相关类型:[IPublicModelProp](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/prop.ts) ### getExtraPropValue @@ -105,7 +105,7 @@ getExtraPropValue(path: string): any; setPropValue(path: string, value: IPublicTypeCompositeValue): void; ``` -相关类型:[IPublicTypeCompositeValue](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) +相关类型:[IPublicTypeCompositeValue](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) ### setExtraPropValue @@ -121,8 +121,7 @@ setPropValue(path: string, value: IPublicTypeCompositeValue): void; setExtraPropValue(path: string, value: IPublicTypeCompositeValue): void; ``` -相关类型:[IPublicTypeCompositeValue](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) - +相关类型:[IPublicTypeCompositeValue](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) ### has @@ -155,6 +154,6 @@ has(key: string): boolean; add(value: IPublicTypeCompositeValue, key?: string | number | undefined): any; ``` -相关类型:[IPublicTypeCompositeValue](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) +相关类型:[IPublicTypeCompositeValue](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) -**@since v1.1.0** \ No newline at end of file +**@since v1.1.0** diff --git a/docs/docs/api/model/resource.md b/docs/docs/api/model/resource.md index a5fdeaf782..7bf094b50f 100644 --- a/docs/docs/api/model/resource.md +++ b/docs/docs/api/model/resource.md @@ -3,9 +3,7 @@ title: Resource sidebar_position: 13 --- -> **[@experimental](./#experimental)**
-> **@types** [IPublicModelResource](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/resource.ts)
-> **@since** v1.1.0 +> **[@experimental](./#experimental)**
> **@types** [IPublicModelResource](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/resource.ts)
> **@since** v1.1.0 ## 属性 @@ -55,4 +53,4 @@ sidebar_position: 13 资源配置信息 -`@type {Object}` \ No newline at end of file +`@type {Object}` diff --git a/docs/docs/api/model/selection.md b/docs/docs/api/model/selection.md index 9fc2e3a1cc..3b36087914 100644 --- a/docs/docs/api/model/selection.md +++ b/docs/docs/api/model/selection.md @@ -2,14 +2,15 @@ title: Selection sidebar_position: 6 --- -> **@types** [IPublicModelSelection](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/selection.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicModelSelection](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/selection.ts)
> **@since** v1.0.0 ## 基本介绍 画布节点选中模型 ## 属性 + ### selected 返回选中的节点 id @@ -17,15 +18,17 @@ sidebar_position: 6 `@type {string[]}` ### node + 返回选中的节点(如多个节点只返回第一个) `@type {IPublicModelNode | null}` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) **@since v1.1.0** ## 方法 + ### select 选中指定节点(覆盖方式) @@ -116,14 +119,15 @@ add(id: string): void; getNodes(): IPublicModelNode[]; ``` -相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) +相关类型:[IPublicModelNode](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts) ### getTopNodes + 获取选区的顶层节点 例如选中的节点为: - DivA - - ChildrenA + - ChildrenA - DivB getNodes 返回的是 [DivA、ChildrenA、DivB],getTopNodes 返回的是 [DivA、DivB],其中 ChildrenA 由于是二层节点,getTopNodes 不会返回 @@ -143,6 +147,7 @@ getTopNodes(includeRoot?: boolean): IPublicModelNode[]; **@since v1.0.16** ## 事件 + ### onSelectionChange 注册 selection 变化事件回调 @@ -156,6 +161,6 @@ getTopNodes(includeRoot?: boolean): IPublicModelNode[]; onSelectionChange(fn: (ids: string[]) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) -**@since v1.1.0** \ No newline at end of file +**@since v1.1.0** diff --git a/docs/docs/api/model/setting-field.md b/docs/docs/api/model/setting-field.md index 226a0c7e5b..1e66be3d6a 100644 --- a/docs/docs/api/model/setting-field.md +++ b/docs/docs/api/model/setting-field.md @@ -2,7 +2,8 @@ title: SettingField sidebar_position: 6 --- -> **@types** [IPublicModelSettingField](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-field.ts)
+ +> **@types** [IPublicModelSettingField](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/setting-field.ts)
## 基本介绍 @@ -16,7 +17,6 @@ setter 设置器操作对象 `@type {boolean}` - #### id 获取设置属性的 id @@ -71,7 +71,7 @@ setter 设置器操作对象 相关章节:[设置器顶层操作对象](./setting-top-entry) -相关类型:[IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts) +相关类型:[IPublicModelSettingTopEntry](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts) #### node @@ -79,7 +79,6 @@ setter 设置器操作对象 `@type {IPublicModelNode | null}` - #### parent 获取设置属性的父设置属性 @@ -88,7 +87,7 @@ setter 设置器操作对象 相关章节:[设置器顶层操作对象](./setting-top-entry) -相关类型:[IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts) +相关类型:[IPublicModelSettingTopEntry](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts) #### top @@ -98,7 +97,7 @@ setter 设置器操作对象 相关章节:[设置器顶层操作对象](./setting-top-entry) -相关类型:[IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts) +相关类型:[IPublicModelSettingTopEntry](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts) #### isSettingField @@ -110,7 +109,7 @@ setter 设置器操作对象 `@type {IPublicModelComponentMeta}` -相关类型:[IPublicModelComponentMeta](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts) +相关类型:[IPublicModelComponentMeta](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts) #### items @@ -118,7 +117,7 @@ setter 设置器操作对象 `@type {Array}` -相关类型:[IPublicTypeCustomView](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/custom-view.ts) +相关类型:[IPublicTypeCustomView](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/custom-view.ts) ## 方法 @@ -147,8 +146,9 @@ setValue(val: IPublicTypeCompositeValue, extraOptions?: IPublicTypeSetValueOptio ``` 相关类型: -- [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) + +- [IPublicTypeCompositeValue](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts) +- [IPublicTypeSetValueOptions](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/set-value-options.ts) #### setPropValue @@ -248,7 +248,7 @@ getProps(): IPublicModelSettingTopEntry; 相关章节:[设置器顶层操作对象](./setting-top-entry) -相关类型:[IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts) +相关类型:[IPublicModelSettingTopEntry](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts) #### isUseVariable @@ -287,7 +287,7 @@ setUseVariable(flag: boolean): void; 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/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/field-config.ts) #### getMockOrValue @@ -339,4 +339,4 @@ remove(): void; onEffect(action: () => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) \ No newline at end of file +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) diff --git a/docs/docs/api/model/setting-top-entry.md b/docs/docs/api/model/setting-top-entry.md index 2e2cad52be..2061c21733 100644 --- a/docs/docs/api/model/setting-top-entry.md +++ b/docs/docs/api/model/setting-top-entry.md @@ -2,7 +2,8 @@ title: SettingTopEntry sidebar_position: 6 --- -> **@types** [IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts)
+ +> **@types** [IPublicModelSettingTopEntry](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts)
## 基本介绍 @@ -30,10 +31,10 @@ setter 设置器顶层操作对象 */ get(propName: string | number): IPublicModelSettingField | null; ``` -相关章节:[设置器操作对象](./setting-field) -相关类型:[IPublicModelSettingField](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-field.ts) +相关章节:[设置器操作对象](./setting-field) +相关类型:[IPublicModelSettingField](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/setting-field.ts) #### getPropValue @@ -71,4 +72,4 @@ setPropValue(propName: string | number, value: any): void; * @param propName */ clearPropValue(propName: string | number): void; -``` \ No newline at end of file +``` diff --git a/docs/docs/api/model/simulatorRender.md b/docs/docs/api/model/simulatorRender.md index f5bacec493..a98703bb2e 100644 --- a/docs/docs/api/model/simulatorRender.md +++ b/docs/docs/api/model/simulatorRender.md @@ -2,14 +2,15 @@ title: SimulatorRender sidebar_position: 6 --- -> **@types** [IPublicModelSimulatorRender](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/simulator-render.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicModelSimulatorRender](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/simulator-render.ts)
> **@since** v1.0.0 ## 基本介绍 画布节点选中模型 ## 属性 + ### components 画布组件列表 @@ -35,4 +36,3 @@ components: { */ rerender: () => void; ``` - diff --git a/docs/docs/api/model/window.md b/docs/docs/api/model/window.md index 9db39996fa..5ba232cb69 100644 --- a/docs/docs/api/model/window.md +++ b/docs/docs/api/model/window.md @@ -3,10 +3,7 @@ title: Window sidebar_position: 12 --- -> **[@experimental](./#experimental)**
-> **@types** [IPublicModelWindow](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/window.ts)
-> **@since** v1.1.0 - +> **[@experimental](./#experimental)**
> **@types** [IPublicModelWindow](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/window.ts)
> **@since** v1.1.0 ## 基本介绍 @@ -39,6 +36,7 @@ sidebar_position: 12 关联模型 [IPublicModelResource](./resource) ### currentEditorView + 窗口当前视图 `@type {IPublicModelEditorView}` @@ -60,22 +58,25 @@ sidebar_position: 12 ## 方法 ### importSchema + 当前窗口导入 schema, 会调用当前窗口对应资源的 import 钩子 ```typescript -function importSchema(schema: IPublicTypeNodeSchema): void +function importSchema(schema: IPublicTypeNodeSchema): void; ``` -相关类型:[IPublicTypeNodeSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) +相关类型:[IPublicTypeNodeSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) ### changeViewType + 修改当前窗口视图类型 ```typescript -function changeViewType(viewName: string): void +function changeViewType(viewName: string): void; ``` ### save + 当前窗口的保存方法,会调用当前窗口对应资源的 save 钩子 ```typescript @@ -92,7 +93,7 @@ function save(): Promise(void) onChangeViewType(fn: (viewName: string) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onSave @@ -102,6 +103,6 @@ onChangeViewType(fn: (viewName: string) => void): IPublicTypeDisposable; onSave(fn: () => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) **@since v1.1.7** diff --git a/docs/docs/api/plugins.md b/docs/docs/api/plugins.md index df025f49e9..a330c89445 100644 --- a/docs/docs/api/plugins.md +++ b/docs/docs/api/plugins.md @@ -2,33 +2,38 @@ title: plugins - 插件 API sidebar_position: 2 --- -> **@types** [IPublicApiPlugins](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/plugins.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicApiPlugins](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/plugins.ts)
> **@since** v1.0.0 ## 模块简介 + 插件管理器,提供编排模块中管理插件的能力。 ## 方法 + ### register + 注册插件 ```typescript async function register( plugin: IPublicTypePlugin, options?: IPublicTypePluginRegisterOptions, -): Promise +): Promise; ``` + 相关 types: -- [IPublicTypePlugin](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/plugin.ts) -- [IPublicTypePluginRegisterOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/plugin-register-options.ts) -其中第一个参数 plugin 通过低代码工具链的插件脚手架生成编写模板,开发者可以参考[这个章节](/site/docs/guide/expand/editor/cli)进行创建 +- [IPublicTypePlugin](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/plugin.ts) +- [IPublicTypePluginRegisterOptions](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/plugin-register-options.ts) +其中第一个参数 plugin 通过低代码工具链的插件脚手架生成编写模板,开发者可以参考[这个章节](/site/docs/guide/expand/editor/cli)进行创建 #### 简单示例 + ```typescript -import { plugins } from '@alilc/lowcode-engine'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { plugins } from '@felce/lowcode-engine'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; const builtinPluginRegistry = (ctx: IPublicModelPluginContext) => { return { @@ -51,24 +56,28 @@ const builtinPluginRegistry = (ctx: IPublicModelPluginContext) => { componentsPane?.disable?.(); project.onSimulatorRendererReady(() => { componentsPane?.enable?.(); - }) + }); }, }; -} +}; builtinPluginRegistry.pluginName = 'builtinPluginRegistry'; await plugins.register(builtinPluginRegistry); ``` + #### 使用 exports 示例 + ```typescript -import { plugins } from '@alilc/lowcode-engine'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { plugins } from '@felce/lowcode-engine'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; const PluginA = (ctx: IPublicModelPluginContext) => { return { async init() {}, - exports() { return { x: 1, } }, + exports() { + return { x: 1 }; + }, }; -} +}; PluginA.pluginName = 'PluginA'; const PluginB = (ctx: IPublicModelPluginContext) => { @@ -78,22 +87,23 @@ const PluginB = (ctx: IPublicModelPluginContext) => { console.log(ctx.plugins.PluginA.x); // => 1 }, }; -} +}; PluginA.pluginName = 'pluginA'; PluginB.pluginName = 'PluginB'; PluginB.meta = { dependencies: ['PluginA'], -} +}; await plugins.register(PluginA); await plugins.register(PluginB); ``` -> 注:ctx 是在插件中获取引擎 API 的唯一渠道,具体定义参见 [IPublicModelPluginContext](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/plugin-context.ts) +> 注:ctx 是在插件中获取引擎 API 的唯一渠道,具体定义参见 [IPublicModelPluginContext](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/plugin-context.ts) #### 设置兼容引擎版本示例 + ```typescript -import { plugins } from '@alilc/lowcode-engine'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { plugins } from '@felce/lowcode-engine'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; const BuiltinPluginRegistry = (ctx: IPublicModelPluginContext) => { return { @@ -110,10 +120,12 @@ BuiltinPluginRegistry.meta = { } await plugins.register(BuiltinPluginRegistry); ``` + #### 设置插件参数版本示例 + ```typescript -import { plugins } from '@alilc/lowcode-engine'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { plugins } from '@felce/lowcode-engine'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; const BuiltinPluginRegistry = (ctx: IPublicModelPluginContext, options: any) => { return { @@ -121,13 +133,12 @@ const BuiltinPluginRegistry = (ctx: IPublicModelPluginContext, options: any) => // 直接传值方式: // 通过 register(xxx, options) 传入 // 通过 options 取出 - // 引擎初始化时也可以设置某插件的全局配置项: // 通过 engine.init(..., preference) 传入 // 通过 ctx.preference.getValue() 取出 }, }; -} +}; BuiltinPluginRegistry.pluginName = 'BuiltinPluginRegistry'; BuiltinPluginRegistry.meta = { preferenceDeclaration: { @@ -155,7 +166,7 @@ BuiltinPluginRegistry.meta = { }, ], }, -} +}; await plugins.register(BuiltinPluginRegistry, { key1: 'abc', key5: 'willNotPassToPlugin' }); ``` @@ -228,15 +239,17 @@ getPluginPreference( ## 相关类型定义 -- [IPublicModelPluginContext](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/plugin-context.ts) -- [IPublicTypePluginConfig](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/plugin-config.ts) -- [IPublicModelPluginInstance](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/plugin-instance.ts) +- [IPublicModelPluginContext](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/plugin-context.ts) +- [IPublicTypePluginConfig](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/plugin-config.ts) +- [IPublicModelPluginInstance](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/plugin-instance.ts) ## 插件元数据工程转化示例 + your-plugin/package.json + ```json { - "name": "@alilc/lowcode-plugin-debug", + "name": "@felce/lowcode-plugin-debug", "lcMeta": { "pluginName": "debug", "meta": { @@ -248,7 +261,9 @@ your-plugin/package.json } } ``` + 转换后的结构: + ```typescript const debug = (ctx: IPublicModelPluginContext, options: any) => { return {}; diff --git a/docs/docs/api/project.md b/docs/docs/api/project.md index 54bd1474cf..3fbdca7ed0 100644 --- a/docs/docs/api/project.md +++ b/docs/docs/api/project.md @@ -2,9 +2,11 @@ title: project - 模型 API sidebar_position: 10 --- + ## 模块简介 引擎编排模块中包含多种模型,包括: + - [文档模型 DocumentModel](./model/document-model) - [节点模型 Node](./model/node) - [节点孩子模型 NodeChildren](./model/node-children) @@ -15,6 +17,7 @@ sidebar_position: 10 ![image.png](https://img.alicdn.com/imgextra/i3/O1CN01B1bAZi1asNU3KaSUJ_!!6000000003385-2-tps-1650-1352.png) 在文档模型内部,又有一些引申模型,比如: + - [历史操作 History)](./model/history) - [画布节点选中 Selection)](./model/selection) - [画布节点悬停 Detecting)](./model/detecting) @@ -25,6 +28,7 @@ sidebar_position: 10 下面来看看 project API 的具体介绍 ## 变量 + ### currentDocument 获取当前的 document 实例 @@ -37,7 +41,7 @@ sidebar_position: 10 get currentDocument(): IPublicModelDocumentModel | null; ``` -相关类型:[IPublicModelDocumentModel](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/document-model.ts) +相关类型:[IPublicModelDocumentModel](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/document-model.ts) ### documents @@ -52,7 +56,7 @@ get currentDocument(): IPublicModelDocumentModel | null; get documents(): IPublicModelDocumentModel[]; ``` -相关类型:[IPublicModelDocumentModel](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/document-model.ts) +相关类型:[IPublicModelDocumentModel](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/document-model.ts) ### simulatorHost @@ -66,10 +70,10 @@ get documents(): IPublicModelDocumentModel[]; get simulatorHost(): IPublicApiSimulatorHost | null; ``` -相关类型:[IPublicApiSimulatorHost](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) - +相关类型:[IPublicApiSimulatorHost](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) ## 方法 + ### openDocument 打开一个 document @@ -84,8 +88,9 @@ openDocument(doc?: string | IPublicTypeRootSchema | undefined): IPublicModelDocu ``` 相关类型: -- [IPublicApiSimulatorHost](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) -- [IPublicTypeRootSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/root-schema.ts) + +- [IPublicApiSimulatorHost](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) +- [IPublicTypeRootSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/root-schema.ts) ### createDocument @@ -102,8 +107,9 @@ createDocument(data?: IPublicTypeRootSchema): IPublicModelDocumentModel | null; ``` 相关类型: -- [IPublicApiSimulatorHost](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) -- [IPublicTypeRootSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/root-schema.ts) + +- [IPublicApiSimulatorHost](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) +- [IPublicTypeRootSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/root-schema.ts) ### removeDocument @@ -118,11 +124,12 @@ createDocument(data?: IPublicTypeRootSchema): IPublicModelDocumentModel | null; removeDocument(doc: IPublicModelDocumentModel): void; ``` -相关类型:[IPublicApiSimulatorHost](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) +相关类型:[IPublicApiSimulatorHost](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) ### getDocumentByFileName 根据 fileName 获取 document + ```typescript /** * 根据 fileName 获取 document @@ -133,7 +140,7 @@ removeDocument(doc: IPublicModelDocumentModel): void; getDocumentByFileName(fileName: string): IPublicModelDocumentModel | null; ``` -相关类型:[IPublicApiSimulatorHost](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) +相关类型:[IPublicApiSimulatorHost](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) ### getDocumentById @@ -149,7 +156,7 @@ getDocumentByFileName(fileName: string): IPublicModelDocumentModel | null; getDocumentById(id: string): IPublicModelDocumentModel | null; ``` -相关类型:[IPublicApiSimulatorHost](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) +相关类型:[IPublicApiSimulatorHost](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) ### exportSchema @@ -165,8 +172,9 @@ exportSchema(stage: IPublicEnumTransformStage): IPublicTypeProjectSchema; ``` 相关类型: -- [IPublicEnumTransformStage](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/enum/transform-stage.ts) -- [IPublicTypeProjectSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/project-schema.ts) + +- [IPublicEnumTransformStage](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/enum/transform-stage.ts) +- [IPublicTypeProjectSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/project-schema.ts) ### importSchema @@ -180,9 +188,11 @@ exportSchema(stage: IPublicEnumTransformStage): IPublicTypeProjectSchema; */ importSchema(schema?: IPublicTypeProjectSchema): void; ``` -相关类型:[IPublicTypeProjectSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/project-schema.ts) + +相关类型:[IPublicTypeProjectSchema](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/project-schema.ts) ### addPropsTransducer + 增加一个属性的管道处理函数 ```typescript @@ -197,38 +207,49 @@ addPropsTransducer( stage: IPublicEnumTransformStage, ): void; ``` + 相关类型: -- [IPublicTypePropsTransducer](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/props-transducer.ts) -- [IPublicEnumTransformStage](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/enum/transform-stage.ts) + +- [IPublicTypePropsTransducer](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/props-transducer.ts) +- [IPublicEnumTransformStage](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/enum/transform-stage.ts) **示例** 在保存的时候删除每一个组件的 props.hidden + ```typescript -import { project } from '@alilc/lowcode-engine'; -import { IPublicTypeCompositeObject, IPublicEnumTransformStage, IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { project } from '@felce/lowcode-engine'; +import { + IPublicTypeCompositeObject, + IPublicEnumTransformStage, + IPublicModelPluginContext, +} from '@felce/lowcode-types'; export const DeleteHiddenTransducer = (ctx: IPublicModelPluginContext) => { return { async init() { const { project } = ctx; - project.addPropsTransducer((props: IPublicTypeCompositeObject): IPublicTypeCompositeObject => { - delete props.hidden; - return props; - }, IPublicEnumTransformStage.Save); + project.addPropsTransducer( + (props: IPublicTypeCompositeObject): IPublicTypeCompositeObject => { + delete props.hidden; + return props; + }, + IPublicEnumTransformStage.Save, + ); }, }; -} +}; DeleteHiddenTransducer.pluginName = 'DeleteHiddenTransducer'; ``` ### setI18n + 设置多语言语料 ```typescript /** * 设置多语言语料 - * 数据格式参考 https://github.com/alibaba/lowcode-engine/blob/main/specs/lowcode-spec.md#2434%E5%9B%BD%E9%99%85%E5%8C%96%E5%A4%9A%E8%AF%AD%E8%A8%80%E7%B1%BB%E5%9E%8Baa + * 数据格式参考 https://github.com/fe-lce/lowcode-engine/blob/main/specs/lowcode-spec.md#2434%E5%9B%BD%E9%99%85%E5%8C%96%E5%A4%9A%E8%AF%AD%E8%A8%80%E7%B1%BB%E5%9E%8Baa * * set I18n data for this project * @param value object @@ -240,6 +261,7 @@ setI18n(value: object): void; **@since v1.0.17** ### setConfig + 设置当前项目配置 ```typescript @@ -259,19 +281,19 @@ setI18n(value: object): void; ```typescript // shims.d.ts -declare module '@alilc/lowcode-types' { +declare module '@felce/lowcode-types' { export interface IPublicTypeAppConfig { - customProp: CustomPropType + customProp: CustomPropType; } } export {}; ``` - ## 事件 ### onRemoveDocument + 绑定删除文档事件 ```typescript @@ -283,7 +305,8 @@ export {}; */ onRemoveDocument(fn: (data: { id: string }) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) + +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) **@since v1.0.16** @@ -300,8 +323,9 @@ onChangeDocument(fn: (doc: IPublicModelDocumentModel) => void): IPublicTypeDispo ``` 相关类型: -- [IPublicModelDocumentModel](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/document-model.ts) -- [IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) + +- [IPublicModelDocumentModel](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/model/document-model.ts) +- [IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onSimulatorHostReady @@ -314,9 +338,11 @@ onChangeDocument(fn: (doc: IPublicModelDocumentModel) => void): IPublicTypeDispo */ onSimulatorHostReady(fn: (host: IPublicApiSimulatorHost) => void): IPublicTypeDisposable; ``` + 相关类型: -- [IPublicApiSimulatorHost](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) -- [IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) + +- [IPublicApiSimulatorHost](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) +- [IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onSimulatorRendererReady @@ -330,4 +356,4 @@ onSimulatorHostReady(fn: (host: IPublicApiSimulatorHost) => void): IPublicTypeDi onSimulatorRendererReady(fn: () => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) diff --git a/docs/docs/api/setters.md b/docs/docs/api/setters.md index 0d3435b3d3..9b3c9d705d 100644 --- a/docs/docs/api/setters.md +++ b/docs/docs/api/setters.md @@ -2,14 +2,17 @@ title: setters - 设置器 API sidebar_position: 10 --- -> **@types** [IPublicApiSetters](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/setters.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicApiSetters](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/setters.ts)
> **@since** v1.0.0 ## 模块简介 + 负责注册设置器、管理设置器的 API。注册自定义设置器之后可以在物料中进行使用。 ## 方法 + ### getSetter + 获取指定 setter ```typescript @@ -21,9 +24,11 @@ sidebar_position: 10 */ getSetter(type: string): IPublicTypeRegisteredSetter | null; ``` -相关类型:[IPublicTypeRegisteredSetter](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/registerd-setter.ts) + +相关类型:[IPublicTypeRegisteredSetter](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/registerd-setter.ts) ### getSettersMap + 获取已注册的所有 settersMap ```typescript @@ -37,9 +42,10 @@ getSettersMap(): Map; ``` -相关类型:[IPublicTypeRegisteredSetter](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/registerd-setter.ts) +相关类型:[IPublicTypeRegisteredSetter](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/registerd-setter.ts) ### registerSetter + 注册一个 setter ```typescript @@ -57,15 +63,18 @@ registerSetter( ``` 相关类型: -- [IPublicTypeRegisteredSetter](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/registerd-setter.ts) -- [IPublicTypeCustomView](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/custom-view.ts) + +- [IPublicTypeRegisteredSetter](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/registerd-setter.ts) +- [IPublicTypeCustomView](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/custom-view.ts) ## 使用示例 + ### 注册官方内置 Setter 到设计器中 + ```typescript -import { setters, skeleton } from '@alilc/lowcode-engine'; +import { setters, skeleton } from '@felce/lowcode-engine'; import { setterMap, pluginMap } from '@alilc/lowcode-engine-ext'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; const SetterRegistry = (ctx: IPublicModelPluginContext) => { return { @@ -93,19 +102,21 @@ const SetterRegistry = (ctx: IPublicModelPluginContext) => { }); }, }; -} +}; SetterRegistry.pluginName = 'SetterRegistry'; await plugins.register(SetterRegistry); ``` ### 开发自定义 Setter + AltStringSetter 代码如下: + ```typescript -import * as React from "react"; -import { Input } from "@alifd/next"; +import * as React from 'react'; +import { Input } from '@alifd/next'; -import "./index.scss"; +import './index.scss'; interface AltStringSetterProps { // 当前值 value: string; @@ -125,14 +136,14 @@ export default class AltStringSetter extends React.PureComponent onChange(val)} > ); @@ -144,11 +155,13 @@ export default class AltStringSetter extends React.PureComponent **@types** [IPublicApiSimulatorHost](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts)
-> **@since** v1.0.0 + +> **@types** [IPublicApiSimulatorHost](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts)
> **@since** v1.0.0 ## 模块简介 + 负责模拟器相关的 API,包括画布尺寸、语言等。 ## 方法 + ### set + 设置 host 配置值 + ```typescript /** * 设置若干用于画布渲染的变量,比如画布大小、locale 等。 @@ -20,22 +24,27 @@ sidebar_position: 10 */ set(key: string, value: any): void; ``` + **示例** 设置若干用于画布渲染的变量,比如画布大小、locale 等。 以设置画布大小为例: 目前支持 3 种定制方式: -```typescript +```typescript // 直接使用内置设备类型 project.simulatorHost.set('device', 'mobile' / 'iphonex' / 'iphone6' / 'default'); // 定制 canvas 的样式类 project.simulatorHost.set('deviceClassName', 'my-canvas-class'); // 最灵活的方式,直接设置 canvas / viewport 的样式(canvas 是外框,viewport 是内框,可以在 canvas 设置手机 / 平板背景图) -project.simulatorHost.set('deviceStyle', { canvas: { width: '300px', backgroundColor: 'red' }, viewport: { width: '280px' } }); +project.simulatorHost.set('deviceStyle', { + canvas: { width: '300px', backgroundColor: 'red' }, + viewport: { width: '280px' }, +}); ``` ### get + 获取模拟器中设置的变量,比如画布大小、locale 等。 ```typescript @@ -50,6 +59,7 @@ get(key: string): any; ``` ### rerender + 触发组件构建,并刷新渲染画布 ```typescript @@ -61,6 +71,7 @@ rerender(): void; ``` ### scrollToNode + 滚动到指定节点 ```typescript @@ -72,4 +83,5 @@ rerender(): void; */ scrollToNode(node: IPublicModelNode): void; ``` + **@since v1.1.0** diff --git a/docs/docs/api/skeleton.md b/docs/docs/api/skeleton.md index 396fad9e9e..31e9fcb70a 100644 --- a/docs/docs/api/skeleton.md +++ b/docs/docs/api/skeleton.md @@ -2,30 +2,36 @@ title: skeleton - 面板 API sidebar_position: 10 --- -> **@types** [IPublicApiSkeleton](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/skeleton.ts)
-> **@since** v1.0.0 +> **@types** [IPublicApiSkeleton](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/skeleton.ts)
> **@since** v1.0.0 ## 模块简介 + 面板 API 提供了面板扩展和管理的能力,如下图蓝色内容都是扩展出来的。 ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01eVA0U41xYRP3e5zo0_!!6000000006455-2-tps-1780-996.png) 页面上可以扩展的区域共 5 个,具体如下: ![image.png](https://img.alicdn.com/imgextra/i3/O1CN014d2AcS1D5c9TshEiQ_!!6000000000165-2-tps-1892-974.png) + ### 基本概念 + #### 扩展区域位置 (area) + ##### topArea 展示在设计器的顶部区域,常见的相关区域的插件主要是: + 1. 注册设计器 Logo; 2. 设计器操作回退和撤销按钮; 3. 全局操作按钮,例如:保存、预览等; + ##### leftArea 左侧区域的展示形式大多数是 Icon 和对应的面板,通过点击 Icon 可以展示对应的面板并隐藏其他的面板。 该区域相关插件的主要有: + 1. 大纲树展示,展示该设计器设计页面的大纲。 2. 组件库,展示注册到设计器中的组件,点击之后,可以从组件库面板中拖拽到设计器的画布中。 3. 数据源面板 @@ -36,17 +42,22 @@ sidebar_position: 10 ##### centerArea 画布区域,由于画布大多数是展示作用,所以一般扩展的种类比较少。常见的扩展有: + 1. 画布大小修改 2. 物料选中扩展区域修改 + ##### rightArea 右侧区域,常用于组件的配置。常见的扩展有:统一处理组件的配置项,例如统一删除某一个配置项,统一添加某一个配置项的。 + ##### toolbar 跟 topArea 类似,按需放置面板插件~ + #### 展示类型 (type) 展示类型用于区分插件在设计器内可操作的几种不同界面类型。主要的几种类型为 PanelDock、Widget、Dock,另有 Panel 类型目前不推荐使用。 + ##### PanelDock PanelDock 是以面板的形式展示在设计器的左侧区域的。其中主要有两个部分组成,一个是图标,一个是面板。当点击图标时可以控制面板的显示和隐藏。 @@ -58,19 +69,20 @@ PanelDock 是以面板的形式展示在设计器的左侧区域的。其中主 其中右上角可以进行固定,可以对弹出的宽度做设定 接入可以参考代码 + ```javascript -import { skeleton } from "@alilc/lowcode-engine"; +import { skeleton } from '@felce/lowcode-engine'; skeleton.add({ - area: "leftArea", // 插件区域 - type: "PanelDock", // 插件类型,弹出面板 - name: "sourceEditor", + area: 'leftArea', // 插件区域 + type: 'PanelDock', // 插件类型,弹出面板 + name: 'sourceEditor', content: SourceEditor, // 插件组件实例 props: { - align: "left", - icon: "wenjian", + align: 'left', + icon: 'wenjian', title: '标题', // 图标下方展示的标题 - description: "JS 面板", + description: 'JS 面板', }, panelProps: { floatable: true, // 是否可浮动 @@ -78,12 +90,14 @@ skeleton.add({ hideTitleBar: false, maxHeight: 800, maxWidth: 1200, - title: "JS 面板", + title: 'JS 面板', width: 600, }, }); ``` + ##### Widget + Widget 形式是直接渲染在当前编辑器的对应位置上。如 demo 中在设计器顶部的所有组件都是这种展现形式。 ![image.png](https://img.alicdn.com/imgextra/i3/O1CN01IRQIZp1m5AJPwBKDv_!!6000000004902-2-tps-1988-94.png) @@ -91,45 +105,46 @@ Widget 形式是直接渲染在当前编辑器的对应位置上。如 demo 中 接入可以参考代码: ```javascript -import { skeleton } from "@alilc/lowcode-engine"; +import { skeleton } from '@felce/lowcode-engine'; // 注册 logo 面板 skeleton.add({ - area: "topArea", - type: "Widget", - name: "logo", - content: Logo, // Widget 组件实例 - contentProps: { // Widget 插件 props - logo: - "https://img.alicdn.com/tfs/TB1_SocGkT2gK0jSZFkXXcIQFXa-66-66.png", - href: "/", + area: 'topArea', + type: 'Widget', + name: 'logo', + content: Logo, // Widget 组件实例 + contentProps: { + // Widget 插件 props + logo: 'https://img.alicdn.com/tfs/TB1_SocGkT2gK0jSZFkXXcIQFXa-66-66.png', + href: '/', }, props: { - align: "left", + align: 'left', width: 100, }, }); ``` + ##### Dock 一个图标的表现形式,可以用于语言切换、跳转到外部链接、打开一个 widget 等场景。 ```javascript -import { skeleton } from "@alilc/lowcode-engine"; +import { skeleton } from '@felce/lowcode-engine'; skeleton.add({ - area: "leftArea", - type: "Dock", - name: "opener", + area: 'leftArea', + type: 'Dock', + name: 'opener', props: { icon: Icon, // Icon 组件实例 - align: "bottom", + align: 'bottom', onClick: function () { // 打开外部链接 window.open('https://lowcode-engine.cn'); // 显示 widget skeleton.showWidget('xxx'); - } - } + }, + }, }); ``` @@ -150,20 +165,18 @@ skeleton.add({ add(config: IPublicTypeWidgetBaseConfig, extraConfig?: Record): any; ``` - IWidgetBaseConfig 定义如下: -| 属性名 | 含义 | 备注 | -| --- | --- | --- | -| name | 面板名称 | | -| area | 扩展区位置,可选值:'topArea' | 'leftArea' | 'rightArea' | 'toolbar' | 'bottomArea' | 'mainArea' | | -| type | 面板类型,可选值:'Widget' | 'PanelDock' | 'Panel' | Dock | 详见前文中对**展示类型**的描述 | -| content | 面板的实现类/节点,类型是 ReactClass | ReactElement | | -| props | 面板属性 | align: 'top' | 'bottom' | 'left' | 'center' | 'right'; // 指定面板 icon 位置区域
icon: string | ReactElement;  // icon 为字符串时,请确定当前 fusion 主题包中包含该 icon
description: string;
condition: Function; // 指定当前面板的显影状态 | -| contentProps | 面板的实现类/节点的参数 | | -| panelProps | 假如 type: 'Panel' | 'PanelDock' 时有效,传给 Panel 类的参数 | keepVisibleWhileDragging: boolean; // 当有元素在当前 panel 拖拽时,是否保持 panel 为展开状态,默认值:false
area: 'leftFloatArea' | 'leftFixedArea' // 指定 panel 位于浮动面板还是钉住面板 | -| index | 面板的位置,不传默认按插件注册顺序 | | - +| 属性名 | 含义 | 备注 | +| ------------ | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| name | 面板名称 | | +| area | 扩展区位置,可选值:'topArea' | 'leftArea' | 'rightArea' | 'toolbar' | 'bottomArea' | 'mainArea' | | +| type | 面板类型,可选值:'Widget' | 'PanelDock' | 'Panel' | Dock | 详见前文中对**展示类型**的描述 | +| content | 面板的实现类/节点,类型是 ReactClass | ReactElement | | +| props | 面板属性 | align: 'top' | 'bottom' | 'left' | 'center' | 'right'; // 指定面板 icon 位置区域
icon: string | ReactElement;  // icon 为字符串时,请确定当前 fusion 主题包中包含该 icon
description: string;
condition: Function; // 指定当前面板的显影状态 | +| contentProps | 面板的实现类/节点的参数 | | +| panelProps | 假如 type: 'Panel' | 'PanelDock' 时有效,传给 Panel 类的参数 | keepVisibleWhileDragging: boolean; // 当有元素在当前 panel 拖拽时,是否保持 panel 为展开状态,默认值:false
area: 'leftFloatArea' | 'leftFixedArea' // 指定 panel 位于浮动面板还是钉住面板 | +| index | 面板的位置,不传默认按插件注册顺序 | | ### remove @@ -191,7 +204,7 @@ remove(config: IPublicTypeWidgetBaseConfig): number | undefined; getPanel(name: string): IPublicModelSkeletonItem | undefined; ``` -相关类型:[IPublicModelSkeletonItem](https://github.com/alibaba/lowcode-engine/blob/main/packages/shell/src/model/skeleton-item.ts) +相关类型:[IPublicModelSkeletonItem](https://github.com/fe-lce/lowcode-engine/blob/main/packages/shell/src/model/skeleton-item.ts) @since v1.1.10 @@ -209,6 +222,7 @@ showPanel(name: string): void; ``` ### hidePanel + 隐藏面板 ```typescript @@ -234,7 +248,9 @@ showWidget(name: string): void; ``` ### enableWidget + 将 widget 启用。 + ```typescript /** * 将 widget 启用 @@ -273,6 +289,7 @@ disableWidget(name: string): void; ``` ### showArea + 显示某个 Area ```typescript @@ -284,8 +301,8 @@ disableWidget(name: string): void; showArea(areaName: string): void; ``` - ### hideArea + 隐藏某个 Area ```typescript @@ -309,9 +326,7 @@ hideArea(areaName: string): void; getAreaItems(areaName: IPublicTypeWidgetConfigArea): IPublicModelSkeletonItem[] | undefined; ``` -相关类型:[IPublicModelSkeletonItem](https://github.com/alibaba/lowcode-engine/blob/main/packages/shell/src/model/skeleton-item.ts) - - +相关类型:[IPublicModelSkeletonItem](https://github.com/fe-lce/lowcode-engine/blob/main/packages/shell/src/model/skeleton-item.ts) ### registerConfigTransducer @@ -321,15 +336,15 @@ getAreaItems(areaName: IPublicTypeWidgetConfigArea): IPublicModelSkeletonItem[] /** * 注册一个面板的配置转换器(transducer)。 * Registers a configuration transducer for a panel. - * @param {IPublicTypeConfigTransducer} transducer + * @param {IPublicTypeConfigTransducer} transducer * - 要注册的转换器函数。该函数接受一个配置对象(类型为 IPublicTypeSkeletonConfig)作为输入,并返回修改后的配置对象。 - * - The transducer function to be registered. This function takes a configuration object - * - * @param {number} level + * - The transducer function to be registered. This function takes a configuration object + * + * @param {number} level * - 转换器的优先级。优先级较高的转换器会先执行。 * - The priority level of the transducer. Transducers with higher priority levels are executed first. - * - * @param {string} [id] + * + * @param {string} [id] * - (可选)转换器的唯一标识符。用于在需要时引用或操作特定的转换器。 * - (Optional) A unique identifier for the transducer. Used for referencing or manipulating a specific transducer when needed. */ @@ -339,7 +354,7 @@ registerConfigTransducer(transducer: IPublicTypeConfigTransducer, level: number, 使用示例 ```typescript -import { IPublicModelPluginContext, IPublicTypeSkeletonConfig } from '@alilc/lowcode-types'; +import { IPublicModelPluginContext, IPublicTypeSkeletonConfig } from '@felce/lowcode-types'; function updatePanelWidth(config: IPublicTypeSkeletonConfig) { if (config.type === 'PanelDock') { @@ -349,7 +364,7 @@ function updatePanelWidth(config: IPublicTypeSkeletonConfig) { ...(config.panelProps || {}), width: 240, }, - } + }; } return config; @@ -376,6 +391,7 @@ export default controlPanelWidthPlugin; ``` ## 事件 + ### onShowPanel 监听 Panel 实例显示事件 @@ -390,7 +406,7 @@ export default controlPanelWidthPlugin; onShowPanel(listener: (paneName?: string, panel?: IPublicModelSkeletonItem) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onHidePanel @@ -406,7 +422,7 @@ onShowPanel(listener: (paneName?: string, panel?: IPublicModelSkeletonItem) => v onHidePanel(listener: (paneName?: string, panel?: IPublicModelSkeletonItem) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onDisableWidget @@ -420,7 +436,7 @@ onHidePanel(listener: (paneName?: string, panel?: IPublicModelSkeletonItem) => v onDisableWidget(listener: (paneName?: string, panel?: IPublicModelSkeletonItem) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onEnableWidget @@ -434,7 +450,7 @@ onDisableWidget(listener: (paneName?: string, panel?: IPublicModelSkeletonItem) onEnableWidget(listener: (paneName?: string, panel?: IPublicModelSkeletonItem) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onShowWidget @@ -450,7 +466,7 @@ onEnableWidget(listener: (paneName?: string, panel?: IPublicModelSkeletonItem) = onShowWidget(listener: (paneName?: string, panel?: IPublicModelSkeletonItem) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onHideWidget @@ -466,15 +482,15 @@ onShowWidget(listener: (paneName?: string, panel?: IPublicModelSkeletonItem) => onHideWidget(listener: (paneName?: string, panel?: IPublicModelSkeletonItem) => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ## 使用示例 ```typescript -import { skeleton } from '@alilc/lowcode-engine'; +import { skeleton } from '@felce/lowcode-engine'; skeleton.add({ - name: 'logo', + name: 'logo', area: 'topArea', type: 'Widget', contentProps: {}, @@ -507,7 +523,6 @@ skeleton.add({ skeleton.showPanel('sourceEditor'); skeleton.hidePanel('sourceEditor'); - // 创建一个浮动的 widget skeleton.add({ name: 'floatingWidget', @@ -521,9 +536,9 @@ skeleton.add({ top: '200px', bottom: 0, width: 'calc(100% - 46px)', - 'background-color': 'lightblue' - } - } + 'background-color': 'lightblue', + }, + }, }); // 显隐 widget @@ -534,9 +549,11 @@ skeleton.hideWidget('floatingWidget'); skeleton.enableWidget('sourceEditor'); skeleton.disableWidget('sourceEditor'); ``` + ### bottomArea 示例 + ```typescript -import { skeleton } from '@alilc/lowcode-engine'; +import { skeleton } from '@felce/lowcode-engine'; skeleton.add({ name: 'bottomAreaPanelName', @@ -545,10 +562,11 @@ skeleton.add({ content: () => 'demoText', }); - skeleton.showPanel('bottomAreaPanelName'); ``` + ### widget 示例 + ```typescript // 注册 logo 面板 skeleton.add({ diff --git a/docs/docs/api/workspace.md b/docs/docs/api/workspace.md index 74f7d6950f..fef81e48be 100644 --- a/docs/docs/api/workspace.md +++ b/docs/docs/api/workspace.md @@ -3,9 +3,7 @@ title: workspace - 应用级 API sidebar_position: 10 --- -> **[@experimental](./#experimental)**
-> **@types** [IPublicApiWorkspace](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/workspace.ts)
-> **@since** v1.1.0 +> **[@experimental](./#experimental)**
> **@types** [IPublicApiWorkspace](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/api/workspace.ts)
> **@since** v1.1.0 ## 模块简介 @@ -70,6 +68,7 @@ get resourceList(): IPublicModelResource; ## 方法 ### registerResourceType + 注册资源 ```typescript @@ -77,7 +76,7 @@ get resourceList(): IPublicModelResource; registerResourceType(resourceTypeModel: IPublicTypeResourceType): void; ``` -相关类型:[IPublicTypeResourceType](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/resource-type.ts) +相关类型:[IPublicTypeResourceType](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/resource-type.ts) ### setResourceList @@ -87,7 +86,7 @@ registerResourceType(resourceTypeModel: IPublicTypeResourceType): void; setResourceList(resourceList: IPublicResourceList) {} ``` -相关类型:[IPublicResourceData](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/resource-list.ts) +相关类型:[IPublicResourceData](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/resource-list.ts) ### openEditorWindow @@ -147,7 +146,7 @@ removeEditorWindowById(id: string): void; function onChangeWindows(fn: () => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onChangeActiveWindow @@ -157,8 +156,7 @@ active 窗口变更事件 function onChangeActiveWindow(fn: () => void): IPublicTypeDisposable; ``` -相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) - +相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) ### onResourceListChange @@ -168,5 +166,5 @@ function onChangeActiveWindow(fn: () => void): IPublicTypeDisposable; onResourceListChange(fn: (resourceList: IPublicResourceList): void): (): IPublicTypeDisposable; ``` -- 相关类型:[IPublicResourceOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/resource-options.ts) -- 相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) +- 相关类型:[IPublicResourceOptions](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/resource-options.ts) +- 相关类型:[IPublicTypeDisposable](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts) diff --git a/docs/docs/demoUsage/appendix/loop.md b/docs/docs/demoUsage/appendix/loop.md index 46f39398af..da536c77e8 100644 --- a/docs/docs/demoUsage/appendix/loop.md +++ b/docs/docs/demoUsage/appendix/loop.md @@ -2,6 +2,7 @@ title: 如何使用循环值 sidebar_position: 0 --- + 1.设置循环数据 ![image.png](https://img.alicdn.com/imgextra/i1/O1CN01Gw1kXO1qaXulQCWap_!!6000000005512-2-tps-3840-1900.png) @@ -19,10 +20,10 @@ this.index 是当前循环的索引值。 3.在事件绑定函数中使用 在事件绑定函数中使用扩展参数设置 -![image](https://github.com/alibaba/lowcode-engine/assets/11935995/7274506e-decd-497a-b07f-c95941a706b4) +![image](https://github.com/fe-lce/lowcode-engine/assets/11935995/7274506e-decd-497a-b07f-c95941a706b4) 绑定之后在函数中使用 -![image](https://github.com/alibaba/lowcode-engine/assets/11935995/9d52ee5c-9959-4991-91be-9391e639bb7e) +![image](https://github.com/fe-lce/lowcode-engine/assets/11935995/9d52ee5c-9959-4991-91be-9391e639bb7e) 按钮点击效果 -![image](https://github.com/alibaba/lowcode-engine/assets/11935995/6ca590c9-1f5f-4d48-94a5-439130a22e92) +![image](https://github.com/fe-lce/lowcode-engine/assets/11935995/6ca590c9-1f5f-4d48-94a5-439130a22e92) diff --git a/docs/docs/demoUsage/panels/datasource.md b/docs/docs/demoUsage/panels/datasource.md index 7e9028e5eb..29a0b0900e 100644 --- a/docs/docs/demoUsage/panels/datasource.md +++ b/docs/docs/demoUsage/panels/datasource.md @@ -2,32 +2,44 @@ title: 8. 数据源面板详解 sidebar_position: 4 --- + ## 🪚 概述 + 数据源面板主要负责管理低代码中远程数据源内容,通过可视化编辑的方式操作低代码协议中的数据源 Schema,配合 [数据源引擎](/site/docs/guide/design/datasourceEngine) 即可实现低代码中数据源的生产和消费; ![image.png](https://img.alicdn.com/imgextra/i1/O1CN0170HeBg276B7fM9rqh_!!6000000007747-2-tps-2878-1642.png) 数据源面板 -## ❓如何使用 + +## ❓ 如何使用 + > 面板内包含了数据源创建、删除、编辑、排序、导入导出、复制以及搜索等能力,内置支持了 `fecth` & `JSONP`两种常用远程请求类型; ### 三步创建一个数据源 + ![image.png](https://img.alicdn.com/imgextra/i2/O1CN01bkgbqj1cOGfwQtEif_!!6000000003590-2-tps-2878-1638.png) 三步创建数据源 ### 参数详解 + > TODO ## ☠️ 更多介绍 + ### 数据源顺序 + > 数据源为何支持排序功能,主要原因是数据源的加载存在先后顺序;接下来我们从协议层以及实现层看数据源之间的顺序关系; TODO + ### 如何定制数据源 + #### 定制数据源类型(设计态) + #### 定制数据源请求实现(运行态) > 当出现以下两种情况的时,我们需要定制数据源请求实现, +> > - 当你默认提供的 `handler`无法满足你的需求 > - 定制了数据源类型,比如 `GraphQL`,需要实现一个对应的 `handler` @@ -54,9 +66,11 @@ export function createFetchHandler(config?: Record) { }; } ``` + 低代码 fetch-handler 默认实现 以上代码是低代码内置的 fetch-handler 默认实现,内部使用了 `universal-request`,假如你们内部使用的 `axios`,你完全重新实现一个; + ```javascript import axios from 'axios'; export function createAxiosFetchHandler(config?: Record) { @@ -76,12 +90,14 @@ export function createAxiosFetchHandler(config?: Record) { ``` ##### 注册到 render + 完成一个 Handler 后你可以通过以下方式接入到 render 或者出码中使用 ###### 渲染 Render + ```tsx import React, { memo } from 'react'; -import ReactRenderer from '@alilc/lowcode-react-renderer'; +import ReactRenderer from '@felce/lowcode-react-renderer'; const SamplePreview = memo(() => { return ( @@ -91,22 +107,24 @@ const SamplePreview = memo(() => { components={components} appHelper={{ requestHandlersMap: { - fetch: createAxiosFetchHandler() - } + fetch: createAxiosFetchHandler(), + }, }} /> ); }); ``` + ###### 出码 + > 目前自定义只能通过重新定义类型来完成,接下来我们会给出码添加 requestHandlersMap 映射能力;如有需求请联系 荣彬 (github-id:xingmolu) +### 设计态启用数据源引擎 -### 设计态启用数据源引擎 > 默认情况下设计态没有开启数据源引擎,我们可以在设计器 init 的时候来传递`requstHandlersMap`来开启;具体代码如下: ```javascript -import { init, plugins } from '@alilc/lowcode-engine'; +import { init, plugins } from '@felce/lowcode-engine'; import { RequestHandlersMap } from '@alilc/lowcode-datasource-types'; const preference = new Map(); @@ -125,8 +143,8 @@ const preference = new Map(); // simulatorUrl 在当 engine-core.js 同一个父路径下时是不需要配置的!!! // 这里因为用的是 alifd cdn,在不同 npm 包,engine-core.js 和 react-simulator-renderer.js 是不同路径 simulatorUrl: [ - 'https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/css/react-simulator-renderer.css', - 'https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/js/react-simulator-renderer.js' + 'https://alifd.alicdn.com/npm/@felce/lowcode-react-simulator-renderer@latest/dist/css/react-simulator-renderer.css', + 'https://alifd.alicdn.com/npm/@felce/lowcode-react-simulator-renderer@latest/dist/js/react-simulator-renderer.js' ], requestHandlersMap: { fetch: createAxiosFetchHandler() @@ -135,20 +153,24 @@ const preference = new Map(); })(); ``` + ## 🥡 附录 + ### 数据源协议 -| **参数** | **说明** | **类型** | **支持变量** | **默认值** | **备注** | -| --- | --- | --- | --- | --- | --- | -| id | 数据请求 ID 标识 | String | - | - | | -| isInit | 是否为初始数据 | Boolean | ✅ | true | 值为 true 时,将在组件初始化渲染时自动发送当前数据请求 | -| isSync | 是否需要串行执行 | Boolean | ✅ | false | 值为 true 时,当前请求将被串行执行 | -| type | 数据请求类型 | String | - | fetch | 支持四种类型:fetch/mtop/jsonp/custom | -| shouldFetch | 本次请求是否可以正常请求 | (options: ComponentDataSourceItemOptions) => boolean | - | () => true | function 参数参考 [ComponentDataSourceItemOptions 对象描述](/site/docs/specs/lowcode-spec#2315-componentdatasourceitemoptions-对象描述) | -| willFetch | 单个数据结果请求参数处理函数 | Function | - | options => options | 只接受一个参数(options),返回值作为请求的 options,当处理异常时,使用原 options。也可以返回一个 Promise,resolve 的值作为请求的 options,reject 时,使用原 options | -| requestHandler | 自定义扩展的外部请求处理器 | Function | - | - | 仅 type=‘custom’时生效 | -| dataHandler | request 成功后的回调函数 | Function | - | response => response.data | 参数:请求成功后 promise 的 value 值 | -| errorHandler | request 失败后的回调函数 | Function | - | - | 参数:请求出错 promise 的 error 内容 | -| options {} | 请求参数 | **ComponentDataSourceItemOptions**| - | - | 每种请求类型对应不同参数,详见见 [ComponentDataSourceItemOptions 对象描述](/site/docs/specs/lowcode-spec#2315-componentdatasourceitemoptions-对象描述) | + +| **参数** | **说明** | **类型** | **支持变量** | **默认值** | **备注** | +| -------------- | ---------------------------- | ---------------------------------------------------- | ------------ | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| id | 数据请求 ID 标识 | String | - | - | | +| isInit | 是否为初始数据 | Boolean | ✅ | true | 值为 true 时,将在组件初始化渲染时自动发送当前数据请求 | +| isSync | 是否需要串行执行 | Boolean | ✅ | false | 值为 true 时,当前请求将被串行执行 | +| type | 数据请求类型 | String | - | fetch | 支持四种类型:fetch/mtop/jsonp/custom | +| shouldFetch | 本次请求是否可以正常请求 | (options: ComponentDataSourceItemOptions) => boolean | - | () => true | function 参数参考 [ComponentDataSourceItemOptions 对象描述](/site/docs/specs/lowcode-spec#2315-componentdatasourceitemoptions-对象描述) | +| willFetch | 单个数据结果请求参数处理函数 | Function | - | options => options | 只接受一个参数(options),返回值作为请求的 options,当处理异常时,使用原 options。也可以返回一个 Promise,resolve 的值作为请求的 options,reject 时,使用原 options | +| requestHandler | 自定义扩展的外部请求处理器 | Function | - | - | 仅 type=‘custom’时生效 | +| dataHandler | request 成功后的回调函数 | Function | - | response => response.data | 参数:请求成功后 promise 的 value 值 | +| errorHandler | request 失败后的回调函数 | Function | - | - | 参数:请求出错 promise 的 error 内容 | +| options {} | 请求参数 | **ComponentDataSourceItemOptions** | - | - | 每种请求类型对应不同参数,详见见 [ComponentDataSourceItemOptions 对象描述](/site/docs/specs/lowcode-spec#2315-componentdatasourceitemoptions-对象描述) | ### 运行时实现层:数据源引擎设计 + [数据源引擎设计](/site/docs/guide/design/datasourceEngine) diff --git a/docs/docs/demoUsage/panels/settings.md b/docs/docs/demoUsage/panels/settings.md index 9023e587ad..79e50a85f3 100644 --- a/docs/docs/demoUsage/panels/settings.md +++ b/docs/docs/demoUsage/panels/settings.md @@ -2,8 +2,11 @@ title: 6. 设置面板详解 sidebar_position: 2 --- + # 设置器介绍 + ## 展示区域 + 设置器,又称为 Setter,主要展示在编辑器的右边区域,如下图: ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01jN0toi1OknXWrPuYt_!!6000000001744-2-tps-3836-1730.png) 其中包含 属性、样式、事件、高级 @@ -13,48 +16,51 @@ sidebar_position: 2 - 事件:如果该物料有声明事件,则会出现事件面板,用于绑定事件。 - 高级:两个逻辑相关的属性,**条件渲染**和**循环** - - ## 设置器 + 上述区域中是有多项设置器的,对于一个组件来说,每一项配置都对应一个设置器,比如我们的配置是一个文本,我们需要的是文本设置器,我们需要配置的是数字,我们需要的就是数字设置器。 下图中的标题和按钮类型配置就分别是文本设置器和下拉框设置器。 ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01Bl2hgm1GiUcXD3TOO_!!6000000000656-2-tps-2120-1460.png) 我们提供了常用的设置器作为内置设置器,也提供了定制能力帮助大家开发特定需求的设置器。 + # 内置设置器 -| **预置 Setter** | **用途** | -| --- | --- | -| StringSetter | 短文本型数据设置器,不可换行 | -| NumberSetter | 数值型数据设置器, | -| BoolSetter | 布尔型数据设置器, | -| SelectSetter | 枚举型数据设置器,采用下拉的形式展现 | -| VariableSetter | 变量型数据设置器, | -| RadioGroupSetter | 枚举型数据设置器,采用 tab 选择的形式展现 | -| TextAreaSetter | 长文本型数据设置器,可换行 | -| DateSetter | 日期型数据设置器 | -| TimePicker | 时间型数据设置器 | -| DateYearSetter | 日期型 - 年数据设置器 | -| DateMonthSetter | 日期型 - 月数据设置器 | -| DateRangeSetter | 日期型数据设置器,可选择时间区间 | -| EventsSetter | 事件绑定设置器 | -| ColorSetter | 颜色设置器 | -| JsonSetter | json 型数据设置器 | -| StyleSetter | 样式设置器 | -| ClassNameSetter | 样式名设置器 | -| FunctionSetter | 函数型数据设置器 | -| MixedSetter | 混合型数据设置器 | -| SlotSetter | 节点型数据设置器 | -| ArraySetter | 列表数组行数据设置器 | -| ObjectSetter | 对象数据设置器,一般内嵌在 ArraySetter 中 | +| **预置 Setter** | **用途** | +| ---------------- | ----------------------------------------- | +| StringSetter | 短文本型数据设置器,不可换行 | +| NumberSetter | 数值型数据设置器, | +| BoolSetter | 布尔型数据设置器, | +| SelectSetter | 枚举型数据设置器,采用下拉的形式展现 | +| VariableSetter | 变量型数据设置器, | +| RadioGroupSetter | 枚举型数据设置器,采用 tab 选择的形式展现 | +| TextAreaSetter | 长文本型数据设置器,可换行 | +| DateSetter | 日期型数据设置器 | +| TimePicker | 时间型数据设置器 | +| DateYearSetter | 日期型 - 年数据设置器 | +| DateMonthSetter | 日期型 - 月数据设置器 | +| DateRangeSetter | 日期型数据设置器,可选择时间区间 | +| EventsSetter | 事件绑定设置器 | +| ColorSetter | 颜色设置器 | +| JsonSetter | json 型数据设置器 | +| StyleSetter | 样式设置器 | +| ClassNameSetter | 样式名设置器 | +| FunctionSetter | 函数型数据设置器 | +| MixedSetter | 混合型数据设置器 | +| SlotSetter | 节点型数据设置器 | +| ArraySetter | 列表数组行数据设置器 | +| ObjectSetter | 对象数据设置器,一般内嵌在 ArraySetter 中 | # 设置器定制 + ## 编写 AltStringSetter + 我们编写一个简单的 Setter,这里我们编写的 Setter 是 AltStringSetter。代码如下: + ```javascript -import * as React from "react"; -import { Input } from "@alifd/next"; +import * as React from 'react'; +import { Input } from '@alifd/next'; -import "./index.scss"; +import './index.scss'; interface AltStringSetterProps { // 当前值 value: string; @@ -74,14 +80,14 @@ export default class AltStringSetter extends React.PureComponent onChange(val)} > ); @@ -90,7 +96,9 @@ export default class AltStringSetter extends React.PureComponent { const { field, value } = this.props; // 这里展示的和插件进行通信,事件规则是插件名 + 方法 event.emit('eventBindDialog.openDialog', field.name, this.emitEventName); -} +}; ``` + ### 修改同级 props 的其他属性值 + setter 本身只影响其中一个 props 的值,如果需要影响其他组件的 props 的值,需要使用 field 的 props: + ```javascript bindFunction = () => { - const { field, value } = this.props; - const propsField = field.parent; - // 获取同级其他属性 showJump 的值 - const otherValue = propsField.getPropValue('showJump'); - // set 同级其他属性 showJump 的值 - propsField.setPropValue('showJump', false); -} + const { field, value } = this.props; + const propsField = field.parent; + // 获取同级其他属性 showJump 的值 + const otherValue = propsField.getPropValue('showJump'); + // set 同级其他属性 showJump 的值 + propsField.setPropValue('showJump', false); +}; ``` + ## 注册 AltStringSetter + 我们需要在低代码引擎中注册 Setter,这样就可以通过 AltStringSetter 的名字在物料中使用了。 + ```javascript import AltStringSetter from './AltStringSetter'; -import { setters } from '@alilc/lowcode-engine'; +import { setters } from '@felce/lowcode-engine'; setters.registerSetter({ - AltStringSetter: { - component: AltStringSetter, - } + AltStringSetter: { + component: AltStringSetter, + }, }); ``` + ## 物料中使用 + 我们需要将目标组件的属性值类型值配置到物料资源配置文件中,例如 `packages/demo/public/assets.json`  其中核心配置如下: + ```json { "props": { @@ -158,7 +177,9 @@ setters.registerSetter({ } } ``` + 在物料中的完整配置如下: + ```json { "componentName": "Message", @@ -184,19 +205,11 @@ setters.registerSetter({ "name": "type", "propType": { "type": "oneOf", - "value": [ - "success", - "warning", - "error", - "notice", - "help", - "loading" - ] + "value": ["success", "warning", "error", "notice", "help", "loading"] }, "description": "反馈类型", "defaultValue": "success" } - ], "configure": { @@ -212,6 +225,9 @@ setters.registerSetter({ } } ``` + ### + # 小结 + 本章介绍了设置器是什么,我们有哪些内置的设置器。以及当不满足设置器诉求时,我们如何定制一个设置器。 diff --git a/docs/docs/faq/faq003.md b/docs/docs/faq/faq003.md index 780614dcfc..139182ce4b 100644 --- a/docs/docs/faq/faq003.md +++ b/docs/docs/faq/faq003.md @@ -3,20 +3,25 @@ title: 点击事件如何添加参数 sidebar_position: 3 tags: [FAQ] --- + 背景: -- [Antd Table 下 button 点击事件怎么拿到行数据?](https://github.com/alibaba/lowcode-engine/issues/341) +- [Antd Table 下 button 点击事件怎么拿到行数据?](https://github.com/fe-lce/lowcode-engine/issues/341) + ## 方式 1 + ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01i58EGG1bxFJBdlS6x_!!6000000003531-2-tps-3342-1126.png) 参考 fusion protable,将操作列直接耦合 button 组件,因为 col.render 函数能拿到 行数据 record,那么 pro-table 组件封装的时候,就可以在渲染操作列按钮的时候,将 col.render 参数透传给 button 组件 ## 方式 2 + slot + 扩展参数 ![image.png](https://img.alicdn.com/imgextra/i2/O1CN01pQk2RC1WBXyxjNDif_!!6000000002750-2-tps-3284-1148.png) 将扩展参数写成: + ```json { record: this.record, @@ -25,6 +30,7 @@ slot + 扩展参数 ``` 那事件处理函数的第二个参数即可得到: + ```json onClick_new_new(...args){ console.log(args) diff --git a/docs/docs/faq/faq009.md b/docs/docs/faq/faq009.md index 4115384353..8b58786758 100644 --- a/docs/docs/faq/faq009.md +++ b/docs/docs/faq/faq009.md @@ -3,29 +3,36 @@ title: 物料出现 Component Not Found 相关报错 sidebar_position: 9 tags: [FAQ] --- + ## 预览态,antd 资产包按顺序加载,但是没有按顺序执行 + 资产包按顺序加载,但是没有按顺序执行,导致部分 js 执行的时候,依赖的资源没有准备好,报错了。 -传给 @alilc/lowcode-react-renderer 的 components 值为空。 +传给 @felce/lowcode-react-renderer 的 components 值为空。 **解决方案** LowCodeEngine 升级到 1.0.8 -> 相关 PR:[https://github.com/alibaba/lowcode-engine/pull/383](https://github.com/alibaba/lowcode-engine/pull/383) +> 相关 PR:[https://github.com/fe-lce/lowcode-engine/pull/383](https://github.com/fe-lce/lowcode-engine/pull/383) ## 编辑态,snippets 和注入组件不对应 + 1.在控制台中输入 + ```json AliLowCodeEngine.material.componentsMap ``` + 查看物料配置是否正常。 ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01bAsPoT1QOTSp7Fmz5_!!6000000001966-2-tps-1640-816.png) 如果正常继续。 LowCodeEngine 需要升级到 1.0.10 + ```json AliLowCodeEngine.project.simulator.renderer.components ``` + 看看对应的物料是否存在,如果不存在,排查物料问题。 如果不正常,查看资产包配置,其中资产包中的 `components` 和 `material.componentsMap` 生成有关系。 @@ -47,23 +54,30 @@ AliLowCodeEngine.project.simulator.renderer.components ``` `material.componentsMap` 不存在相关的组件信息,原因有两个: + - 没有添加对应的物料到 components 字段中 - components 配置不正确,需要查看 url 是否正常加载,查看 exportName 是否配置正确,即 `window.${exportName}` 是否存在。 -2.选中组件,在控制台中输入 + 2.选中组件,在控制台中输入 + ```json AliLowCodeEngine.project.currentDocument.selection.getNodes()[0].exportSchema('render') ``` + 查看 componentName 是否匹配。 3.调用 rerender 方法 + ```json AliLowCodeEngine.project.simulator.rerender() ``` + 看一下问题是否恢复。 ## 排查物料问题 + 找到对应组件的资产包,比如下图的资产包。 + ```json { "package": "@yingzhi8/lowcode-public-package", @@ -88,9 +102,13 @@ AliLowCodeEngine.project.simulator.rerender() ``` ### 查看 urls 是否加载 + 通过查看控制台,看加载的 urls + ### library 配置是否正确 -library 是可以在画布上访问到全局变量,确定 library 是否正确,在控制台输入: + +library 是可以在画布上访问到全局变量,确定 library 是否正确,在控制台输入: + ```json AliLowCodeEngine.project.simulator.contentWindow.${library} ``` diff --git a/docs/docs/faq/faq013.md b/docs/docs/faq/faq013.md index a8f86b2948..303a32e31d 100644 --- a/docs/docs/faq/faq013.md +++ b/docs/docs/faq/faq013.md @@ -3,19 +3,26 @@ title: Modal 类组件 hidden 属性被强制设置 true sidebar_position: 13 tags: [FAQ] --- + ## 注意 + 弹窗的正确弹出方式请参考:[如何通过按钮展示/隐藏弹窗](/site/docs/demoUsage/makeStuff/dialog) + ## 问题原因 + 由于 hidden 属性,导致 Modal 组件在预览的时候不渲染,也就无法获取到实例。 + ## 处理方式 + ### 【推荐】升级到 Engine Verison 1.0.11 以上 + ### 新增 save propsReducer 通过新增 Save 态的 propsReducer,将 hidden props 去掉。可以参考下面的代码: ```typescript -import { project } from '@alilc/lowcode-engine'; -import { IPublicEnumTransformStage } from '@alilc/lowcode-types'; +import { project } from '@felce/lowcode-engine'; +import { IPublicEnumTransformStage } from '@felce/lowcode-types'; export const deleteHiddenTransducer = (ctx: any) => { return { @@ -27,15 +34,15 @@ export const deleteHiddenTransducer = (ctx: any) => { }, IPublicEnumTransformStage.Save); }, }; -} +}; deleteHiddenTransducer.pluginName = 'deleteHiddenTransducer'; - ``` ### 导出 schema 使用 Save 态 + ```typescript -import { TransformStage } from '@alilc/lowcode-types'; +import { TransformStage } from '@felce/lowcode-types'; -const schema = project.exportSchema(TransformStage.Save) +const schema = project.exportSchema(TransformStage.Save); ``` diff --git a/docs/docs/faq/faq014.md b/docs/docs/faq/faq014.md index 8f5f15fe31..1cccfaee08 100644 --- a/docs/docs/faq/faq014.md +++ b/docs/docs/faq/faq014.md @@ -3,18 +3,25 @@ title: VERSION_PLACEHOLDER is not defined sidebar_position: 14 tags: [FAQ] --- + # 问题原因 -由于 lowcode-engine 目前只提供 cdn 的使用方式。如果是自己创建的项目,遇到这个报错了,主要是因为将 npm 包打包进去了。 + +由于 lowcode-engine 目前只提供 cdn 的使用方式。如果是自己创建的项目,遇到这个报错了,主要是因为将 npm 包打包进去了。 # 解决方案 ## engine-demo 项目 -在项目的 externals 配置里加[一行配置](https://github.com/alibaba/lowcode-demo/blob/f8afad0df3190565caccc0a1dfd750dbf84c680f/build.json#L16) + +在项目的 externals 配置里加[一行配置](https://github.com/fe-lce/lowcode-demo/blob/f8afad0df3190565caccc0a1dfd750dbf84c680f/build.json#L16) ## 其他项目 + [相关文档](/site/docs/guide/create/useEditor#引入-umd-包资源) + ### webpack + [https://webpack.docschina.org/configuration/externals/](https://webpack.docschina.org/configuration/externals/) ### 使用文档 + 待补充 diff --git a/docs/docs/faq/faq018.md b/docs/docs/faq/faq018.md index b5a5902404..679eef1989 100644 --- a/docs/docs/faq/faq018.md +++ b/docs/docs/faq/faq018.md @@ -3,8 +3,9 @@ title: 是否可以生成 Vue 页面代码? sidebar_position: 18 tags: [FAQ] --- + 低代码引擎在架构上是和具体语言无关的,通过一定的扩展和插件是可以生成 Vue 页面代码的。 -如果只是用现有的基于 React 的 fusion 物料来搭建,只是在最终出码的时候生成 Vue 页面代码,那您需要准备一套和 fusion 兼容的 vue 物料,并定制个出码方案,将[下面的一些出码插件](https://github.com/alibaba/lowcode-engine/blob/main/modules/code-generator/src/solutions/icejs.ts)替换成生成 Vue 框架的即可: +如果只是用现有的基于 React 的 fusion 物料来搭建,只是在最终出码的时候生成 Vue 页面代码,那您需要准备一套和 fusion 兼容的 vue 物料,并定制个出码方案,将[下面的一些出码插件](https://github.com/fe-lce/lowcode-engine/blob/main/modules/code-generator/src/solutions/icejs.ts)替换成生成 Vue 框架的即可: ![image.png](https://img.alicdn.com/imgextra/i3/O1CN01VxkwCL1l85DiDC2BO_!!6000000004773-2-tps-974-1368.png) 详细定制方案可以参考下[《自定义出码》](/site/docs/guide/expand/runtime/codeGeneration#5自定义出码)。 如果您希望在搭建的时候也使用 Vue 的物料,则还需要扩展定制入料、画布和渲染器等模块,详细方案请参考下[《扩展低代码编辑器》](/site/docs/guide/expand/editor/summary) diff --git a/docs/docs/faq/faq023.md b/docs/docs/faq/faq023.md index e03f7118e0..72ee0c1ef4 100644 --- a/docs/docs/faq/faq023.md +++ b/docs/docs/faq/faq023.md @@ -5,16 +5,20 @@ tags: [FAQ] --- ## 问题描述 + 在低代码引擎的页面渲染过程中,可能会遇到一个关于Slot组件的报错,提示“Slot找不到”。实际上,在渲染态时不应使用Slot组件。 ## 问题原因 + 低代码引擎渲染分为两个状态:设计态和渲染态。 + - **设计态**:为了帮助插槽进行可视化设计,引入了Slot组件。 - **渲染态**:在此状态下,不需要使用Slot组件。 这个问题通常是因为在渲染态错误地使用了设计态的schema。 ## 解决方案 + 1. **区分设计态和渲染态**:通过`project.exportSchema(TransformStage.Save)`的参数来区分。 - `TransformStage.Save`代表渲染态的schema,其中不包含Slot组件。 - 【默认值】`TransformStage.Render`代表设计态的schema,其中包含Slot组件。 @@ -22,10 +26,12 @@ tags: [FAQ] 3. **处理脏数据问题**:如果问题是由脏数据导致,清除数据并重新拖拽组件以恢复正常。 ## 注意事项 + - 确保在代码和配置中正确区分设计态和渲染态。 - 如果遇到持续的问题,检查是否有脏数据或配置错误,并进行相应的清理和调整。 ## 相关链接 -- Issue链接:[Issue #1798](https://github.com/alibaba/lowcode-engine/issues/1798) + +- Issue链接:[Issue #1798](https://github.com/fe-lce/lowcode-engine/issues/1798) --- diff --git a/docs/docs/faq/faq024.md b/docs/docs/faq/faq024.md index ab1b68f5d7..4dfc4acbfa 100644 --- a/docs/docs/faq/faq024.md +++ b/docs/docs/faq/faq024.md @@ -4,13 +4,11 @@ sidebar_position: 23 tags: [FAQ] --- -#### 如何判断是否开启了IDE模式? +#### 如何判断是否开启了 IDE 模式? -- **通过官方API判断**:您可以通过访问 [workspace.isActive](/site/docs/api/workspace#isactive) 来判断当前是否处于IDE模式。这是阿里低代码引擎提供的一个官方API,专门用于确认是否处于集成开发环境。 +- **通过官方 API 判断**:您可以通过访问 [workspace.isActive](/site/docs/api/workspace#isactive) 来判断当前是否处于 IDE 模式。这是阿里低代码引擎提供的一个官方 API,专门用于确认是否处于集成开发环境。 - - -#### 如何使用插件的ctx来做判断在哪个模式下? +#### 如何使用插件的 ctx 来做判断在哪个模式下? - **插件是否为应用级别**:可以通过 **ctx.isPluginRegisteredInWorkspace** 方法来判断一个插件是否是应用级别的插件。这有助于理解插件在阿里低代码引擎中的作用域和潜在的使用场景。 - **插件的注册级别**:您可以使用 **ctx.registerLevel** 属性来判断插件处于哪个级别。插件级别的值包括: @@ -19,31 +17,25 @@ tags: [FAQ] - **Resource**:资源级别。 - **EditorView**:编辑视图级别。 这些级别代表了插件可能的作用域和使用场景,有助于在开发和管理低代码应用时对插件进行更精确的控制和配置。 +#### 如何在 IDE 模式下设置资源列表? - -#### 如何在IDE模式下设置资源列表? - -- **设置资源列表API**:在IDE模式下,可以通过访问 [workspace.setResourceList](/site/docs/api/workspace#setresourcelist) 来设置或更新IDE中的资源列表。这确保您在编辑器窗口中打开的资源是最新且可访问的。 - - +- **设置资源列表 API**:在 IDE 模式下,可以通过访问 [workspace.setResourceList](/site/docs/api/workspace#setresourcelist) 来设置或更新 IDE 中的资源列表。这确保您在编辑器窗口中打开的资源是最新且可访问的。 #### 如何打开视图窗口? - **使用推荐的方法**:使用 `openEditorWindow(resource: Resource, sleep?: boolean): Promise;` 来打开视图窗口。这里的 **resource** 参数指的是您要打开的特定资源,可通过 [workspace.resourceList](/site/docs/api/workspace#resourcelist) 获取。 - **不推荐使用的过时方法**:有一个过时的方法 `openEditorWindow(resourceName: string, id: string, extra: Object, viewName?: string, sleep?: boolean): Promise;` 也用于打开视图窗口。虽然仍然可用,但官方不推荐使用此方法,并计划在后续版本中废弃,因为它在维护和可扩展性方面存在限制。 - - #### 如何在全局插件中获取视图的上下文? -- 在阿里低代码引擎的全局插件中获取视图的上下文,可以通过使用 **ProvideViewPluginContext** 函数实现。这个函数来自 **@alilc/lowcode-utils** 库,它使得您的 React 组件能够接收 **pluginContext** 作为 props,进而访问和操作当前视图的状态和属性。 +- 在阿里低代码引擎的全局插件中获取视图的上下文,可以通过使用 **ProvideViewPluginContext** 函数实现。这个函数来自 **@felce/lowcode-utils** 库,它使得您的 React 组件能够接收 **pluginContext** 作为 props,进而访问和操作当前视图的状态和属性。 **步骤** **引入依赖**:首先,确保您的插件文件中已经引入了 **ProvideViewPluginContext** 以及其他必要的依赖。 ``` -import { ProvideViewPluginContext } from '@alilc/lowcode-utils'; +import { ProvideViewPluginContext } from '@felce/lowcode-utils ``` **定义 React 组件**:创建一个 React 组件,它将使用来自 **ProvideViewPluginContext** 的 **pluginContext**。 @@ -67,23 +59,19 @@ const globalPlugin = (ctx) => { name: 'datapool', content: ProvideViewPluginContext((props) => { // 组件内容 - return ( - - ) + return ; }), // 其他配置 contentProps: { // 需要提供 pluginContext 作为参数 pluginContext: ctx, - } + }, }); }; ``` 通过这些步骤,您的全局插件中的 React 组件就能够获取并使用视图的上下文了。这为您在插件中实现更复杂的功能和交互提供了基础。 - - **注意事项** - **组件重渲染**:正常情况下,**pluginsContext** 是视图的上下文。当视图切换时,组件会重新渲染。如果需要在组件中处理视图切换导致的重新渲染,可以利用 React 的 **key** 属性。 @@ -102,8 +90,6 @@ ProvideViewPluginContext(props => { 通过这种方式,当视图切换时,组件会根据视图的不同进行重新渲染,确保组件状态与当前视图的上下文保持一致。这对于在低代码平台上开发复杂插件和交互功能是非常有用的。 - - #### 如何判断插件是否在 Workspace 模式下注册? **使用** **ctx.isPluginRegisteredInWorkspace()** **方法**: @@ -112,9 +98,9 @@ ProvideViewPluginContext(props => { ```javascript if (ctx.isPluginRegisteredInWorkspace('pluginName')) { - console.log('插件已在 Workspace 模式下注册。'); + console.log('插件已在 Workspace 模式下注册。'); } else { - console.log('插件未在 Workspace 模式下注册。'); + console.log('插件未在 Workspace 模式下注册。'); } ``` @@ -126,8 +112,8 @@ if (ctx.isPluginRegisteredInWorkspace('pluginName')) { ```javascript if (ctx.registerLevel !== IPublicEnumPluginRegisterLevel.Workspace) { - console.log('插件未在 Workspace 模式下注册。'); + console.log('插件未在 Workspace 模式下注册。'); } else { - console.log('插件已在 Workspace 模式下注册。'); + console.log('插件已在 Workspace 模式下注册。'); } ``` diff --git a/docs/docs/guide/appendix/npms.md b/docs/docs/guide/appendix/npms.md index b0292c2739..71b8e8ff59 100644 --- a/docs/docs/guide/appendix/npms.md +++ b/docs/docs/guide/appendix/npms.md @@ -2,46 +2,47 @@ title: NPM 包对应源码位置汇总 sidebar_position: 3 --- -| 包名 | 仓库 | 路径 | -| --- | --- | --- | -| @alilc/lowcode-code-generator | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | modules/code-generator | -| @alilc/lowcode-material-parser | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | modules/material-parser | -| @alilc/lowcode-designer | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/designer | -| @alilc/lowcode-editor-core | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/editor-core | -| @alilc/lowcode-editor-skeleton | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/editor-skeleton | -| @alilc/lowcode-engine | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/engine | -| @alilc/lowcode-plugin-designer | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/plugin-designer | -| @alilc/lowcode-plugin-outline-pane | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/plugin-outline-pane | -| @alilc/lowcode-react-renderer | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/react-renderer | -| @alilc/lowcode-react-simulator-renderer | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/react-simulator-renderer | -| @alilc/lowcode-renderer-core | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/renderer-core | -| @alilc/lowcode-shell | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/shell | -| @alilc/lowcode-types | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/types | -| @alilc/lowcode-utils | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/utils | -| @alilc/lowcode-datasource-engine | [https://github.com/alibaba/lowcode-datasource](https://github.com/alibaba/lowcode-datasource) | packages/datasource-engine | -| @alilc/lowcode-datasource-fetch-handler | [https://github.com/alibaba/lowcode-datasource](https://github.com/alibaba/lowcode-datasource) | packages/datasource-fetch-handler | -| @alilc/lowcode-datasource-jsonp-handler | [https://github.com/alibaba/lowcode-datasource](https://github.com/alibaba/lowcode-datasource) | packages/datasource-jsonp-handler | -| @alilc/lowcode-datasource-mopen-handler | [https://github.com/alibaba/lowcode-datasource](https://github.com/alibaba/lowcode-datasource) | packages/datasource-mopen-handler | -| @alilc/lowcode-datasource-mtop-handler | [https://github.com/alibaba/lowcode-datasource](https://github.com/alibaba/lowcode-datasource) | packages/datasource-mtop-handler | -| @alilc/lowcode-datasource-types | [https://github.com/alibaba/lowcode-datasource](https://github.com/alibaba/lowcode-datasource) | packages/datasource-types | -| @alilc/lowcode-datasource-universal-mtop-handler | [https://github.com/alibaba/lowcode-datasource](https://github.com/alibaba/lowcode-datasource) | packages/datasource-universal-mtop-handler | -| @alilc/lowcode-datasource-url-params-handler | [https://github.com/alibaba/lowcode-datasource](https://github.com/alibaba/lowcode-datasource) | packages/datasource-url-params-handler | -| @alilc/build-plugin-alt | [https://github.com/alibaba/lowcode-tools](https://github.com/alibaba/lowcode-tools) | packages/build-plugin-alt | -| @alilc/create-element | [https://github.com/alibaba/lowcode-tools](https://github.com/alibaba/lowcode-tools) | packages/create-element | -| @alilc/lowcode-plugin-inject | [https://github.com/alibaba/lowcode-tools](https://github.com/alibaba/lowcode-tools) | packages/lowcode-plugin-inject | -| @alilc/action-block | [https://github.com/alibaba/lowcode-plugins](https://github.com/alibaba/lowcode-plugins) | packages/action-block | -| @alilc/lowcode-plugin-base-monaco-editor | [https://github.com/alibaba/lowcode-plugins](https://github.com/alibaba/lowcode-plugins) | packages/plugin-base-monaco-editor | -| @alilc/lowcode-plugin-block | [https://github.com/alibaba/lowcode-plugins](https://github.com/alibaba/lowcode-plugins) | packages/plugin-block | -| @alilc/lowcode-plugin-code-editor | [https://github.com/alibaba/lowcode-plugins](https://github.com/alibaba/lowcode-plugins) | packages/plugin-code-editor | -| @alilc/lowcode-plugin-components-pane | [https://github.com/alibaba/lowcode-plugins](https://github.com/alibaba/lowcode-plugins) | packages/plugin-components-pane | -| @alilc/lowcode-plugin-datasource-pane | [https://github.com/alibaba/lowcode-plugins](https://github.com/alibaba/lowcode-plugins) | packages/plugin-datasource-pane | -| @alilc/lowcode-plugin-manual | [https://github.com/alibaba/lowcode-plugins](https://github.com/alibaba/lowcode-plugins) | packages/plugin-manual | -| @alilc/lowcode-plugin-schema | [https://github.com/alibaba/lowcode-plugins](https://github.com/alibaba/lowcode-plugins) | packages/plugin-schema | -| @alilc/lowcode-plugin-undo-redo | [https://github.com/alibaba/lowcode-plugins](https://github.com/alibaba/lowcode-plugins) | packages/plugin-undo-redo | -| @alilc/lowcode-plugin-zh-en | [https://github.com/alibaba/lowcode-plugins](https://github.com/alibaba/lowcode-plugins) | packages/plugin-zh-en | -| @alifd/fusion-ui | [https://github.com/alibaba/lowcode-materials](https://github.com/alibaba/lowcode-materials) | packages/fusion-ui | -| @alilc/lowcode-materials | [https://github.com/alibaba/lowcode-materials](https://github.com/alibaba/lowcode-materials) | packages/fusion-lowcode-materials | -| @alilc/antd-lowcode-materials | [https://github.com/alibaba/lowcode-materials](https://github.com/alibaba/lowcode-materials) | packages/antd-lowcode-materials | -| @alifd/layout(原 @alifd/pro-layout 升级后的版本) | [https://github.com/alibaba-fusion/layout](https://github.com/alibaba-fusion/layout) | | -| | | | -| | | | + +| 包名 | 仓库 | 路径 | +| -------------------------------------------------- | -------------------------------------------------------------------------------------------- | ------------------------------------------ | +| @felce/lowcode-code-generator | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | modules/code-generator | +| @felce/lowcode-material-parser | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | modules/material-parser | +| @felce/lowcode-designer | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | packages/designer | +| @felce/lowcode-editor-core | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | packages/editor-core | +| @felce/lowcode-editor-skeleton | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | packages/editor-skeleton | +| @felce/lowcode-engine | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | packages/engine | +| @felce/lowcode-plugin-designer | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | packages/plugin-designer | +| @felce/lowcode-plugin-outline-pane | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | packages/plugin-outline-pane | +| @felce/lowcode-react-renderer | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | packages/react-renderer | +| @felce/lowcode-react-simulator-renderer | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | packages/react-simulator-renderer | +| @felce/lowcode-renderer-core | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | packages/renderer-core | +| @felce/lowcode-shell | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | packages/shell | +| @felce/lowcode-types | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | packages/types | +| @felce/lowcode-utils | [https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) | packages/utils | +| @alilc/lowcode-datasource-engine | [https://github.com/fe-lce/lowcode-datasource](https://github.com/fe-lce/lowcode-datasource) | packages/datasource-engine | +| @alilc/lowcode-datasource-fetch-handler | [https://github.com/fe-lce/lowcode-datasource](https://github.com/fe-lce/lowcode-datasource) | packages/datasource-fetch-handler | +| @alilc/lowcode-datasource-jsonp-handler | [https://github.com/fe-lce/lowcode-datasource](https://github.com/fe-lce/lowcode-datasource) | packages/datasource-jsonp-handler | +| @alilc/lowcode-datasource-mopen-handler | [https://github.com/fe-lce/lowcode-datasource](https://github.com/fe-lce/lowcode-datasource) | packages/datasource-mopen-handler | +| @alilc/lowcode-datasource-mtop-handler | [https://github.com/fe-lce/lowcode-datasource](https://github.com/fe-lce/lowcode-datasource) | packages/datasource-mtop-handler | +| @alilc/lowcode-datasource-types | [https://github.com/fe-lce/lowcode-datasource](https://github.com/fe-lce/lowcode-datasource) | packages/datasource-types | +| @alilc/lowcode-datasource-universal-mtop-handler | [https://github.com/fe-lce/lowcode-datasource](https://github.com/fe-lce/lowcode-datasource) | packages/datasource-universal-mtop-handler | +| @alilc/lowcode-datasource-url-params-handler | [https://github.com/fe-lce/lowcode-datasource](https://github.com/fe-lce/lowcode-datasource) | packages/datasource-url-params-handler | +| @alilc/build-plugin-alt | [https://github.com/fe-lce/lowcode-tools](https://github.com/fe-lce/lowcode-tools) | packages/build-plugin-alt | +| @alilc/create-element | [https://github.com/fe-lce/lowcode-tools](https://github.com/fe-lce/lowcode-tools) | packages/create-element | +| @alilc/lowcode-plugin-inject | [https://github.com/fe-lce/lowcode-tools](https://github.com/fe-lce/lowcode-tools) | packages/lowcode-plugin-inject | +| @alilc/action-block | [https://github.com/fe-lce/lowcode-plugins](https://github.com/fe-lce/lowcode-plugins) | packages/action-block | +| @alilc/lowcode-plugin-base-monaco-editor | [https://github.com/fe-lce/lowcode-plugins](https://github.com/fe-lce/lowcode-plugins) | packages/plugin-base-monaco-editor | +| @alilc/lowcode-plugin-block | [https://github.com/fe-lce/lowcode-plugins](https://github.com/fe-lce/lowcode-plugins) | packages/plugin-block | +| @alilc/lowcode-plugin-code-editor | [https://github.com/fe-lce/lowcode-plugins](https://github.com/fe-lce/lowcode-plugins) | packages/plugin-code-editor | +| @alilc/lowcode-plugin-components-pane | [https://github.com/fe-lce/lowcode-plugins](https://github.com/fe-lce/lowcode-plugins) | packages/plugin-components-pane | +| @alilc/lowcode-plugin-datasource-pane | [https://github.com/fe-lce/lowcode-plugins](https://github.com/fe-lce/lowcode-plugins) | packages/plugin-datasource-pane | +| @alilc/lowcode-plugin-manual | [https://github.com/fe-lce/lowcode-plugins](https://github.com/fe-lce/lowcode-plugins) | packages/plugin-manual | +| @alilc/lowcode-plugin-schema | [https://github.com/fe-lce/lowcode-plugins](https://github.com/fe-lce/lowcode-plugins) | packages/plugin-schema | +| @alilc/lowcode-plugin-undo-redo | [https://github.com/fe-lce/lowcode-plugins](https://github.com/fe-lce/lowcode-plugins) | packages/plugin-undo-redo | +| @alilc/lowcode-plugin-zh-en | [https://github.com/fe-lce/lowcode-plugins](https://github.com/fe-lce/lowcode-plugins) | packages/plugin-zh-en | +| @alifd/fusion-ui | [https://github.com/fe-lce/lowcode-materials](https://github.com/fe-lce/lowcode-materials) | packages/fusion-ui | +| @alilc/lowcode-materials | [https://github.com/fe-lce/lowcode-materials](https://github.com/fe-lce/lowcode-materials) | packages/fusion-lowcode-materials | +| @alilc/antd-lowcode-materials | [https://github.com/fe-lce/lowcode-materials](https://github.com/fe-lce/lowcode-materials) | packages/antd-lowcode-materials | +| @alifd/layout(原 @alifd/pro-layout 升级后的版本) | [https://github.com/fe-lce-fusion/layout](https://github.com/fe-lce-fusion/layout) | | +| | | | +| | | | diff --git a/docs/docs/guide/appendix/repos.md b/docs/docs/guide/appendix/repos.md index 87852258d2..4dacd23ec2 100644 --- a/docs/docs/guide/appendix/repos.md +++ b/docs/docs/guide/appendix/repos.md @@ -2,10 +2,12 @@ title: 低代码仓库列表 sidebar_position: 2 --- + ## 1. 引擎主包 + 包含引擎的 4 大模块,入料、编排、渲染和出码。 -仓库地址:[https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) +仓库地址:[https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) 子包明细: 1. designer @@ -24,40 +26,43 @@ sidebar_position: 2 14. code-generator ## 2. 引擎官方扩展包 + 包含了常用的设置器(setter)、跟 setter 绑定的插件等 -仓库地址:[https://github.com/alibaba/lowcode-engine-ext](https://github.com/alibaba/lowcode-engine-ext) +仓库地址:[https://github.com/fe-lce/lowcode-engine-ext](https://github.com/fe-lce/lowcode-engine-ext) 子包明细: - 设置器 setter - - array-setter - - bool-setter - - classname-setter - - color-setter - - events-setter - - expression-setter - - function-setter - - i18n-setter - - icon-setter - - json-setter - - mixed-setter - - number-setter - - object-setter - - out.txt - - radiogroup-setter - - select-setter - - slot-setter - - string-setter - - style-setter - - textarea-setter - - variable-setter + - array-setter + - bool-setter + - classname-setter + - color-setter + - events-setter + - expression-setter + - function-setter + - i18n-setter + - icon-setter + - json-setter + - mixed-setter + - number-setter + - object-setter + - out.txt + - radiogroup-setter + - select-setter + - slot-setter + - string-setter + - style-setter + - textarea-setter + - variable-setter - 插件 plugin - - plugin-event-bind-dialog 事件绑定浮层 - - plugin-variable-bind-dialog 变量绑定浮层 + - plugin-event-bind-dialog 事件绑定浮层 + - plugin-variable-bind-dialog 变量绑定浮层 + ## 3. 低代码插件 + 包含了常用的插件等 -仓库地址:[https://github.com/alibaba/lowcode-plugins](https://github.com/alibaba/lowcode-plugins) +仓库地址:[https://github.com/fe-lce/lowcode-plugins](https://github.com/fe-lce/lowcode-plugins) 子包明细: - base-monaco-editor 基础代码编辑器 @@ -69,17 +74,26 @@ sidebar_position: 2 - plugin-zh-cn 中英文切换功能 ## 4. 引擎 demo + 展示使用引擎编排和渲染等模块以及相应的依赖资源配置基础 demo -仓库地址:[https://github.com/alibaba/lowcode-demo](https://github.com/alibaba/lowcode-demo) +仓库地址:[https://github.com/fe-lce/lowcode-demo](https://github.com/fe-lce/lowcode-demo) + ## 5. 工具链包 + 包含生成引擎生态元素(setter、物料、插件)的脚手架,启动脚本,调试插件等 -仓库地址:[https://github.com/alibaba/lowcode-tools](https://github.com/alibaba/lowcode-tools) +仓库地址:[https://github.com/fe-lce/lowcode-tools](https://github.com/fe-lce/lowcode-tools) + ## 6. 低代码数据源引擎 + 负责在渲染&出码两种运行时实现数据源管理,承担低代码搭建数据请求的能力; -仓库地址:[https://github.com/alibaba/lowcode-datasource](https://github.com/alibaba/lowcode-datasource) +仓库地址:[https://github.com/fe-lce/lowcode-datasource](https://github.com/fe-lce/lowcode-datasource) + ## 7. 基础物料 & 物料描述 -仓库地址:[https://github.com/alibaba/lowcode-materials](https://github.com/alibaba/lowcode-materials) + +仓库地址:[https://github.com/fe-lce/lowcode-materials](https://github.com/fe-lce/lowcode-materials) + ## 8. 出码 demo -仓库地址:[https://github.com/alibaba/lowcode-code-generator-demo](https://github.com/alibaba/lowcode-code-generator-demo) + +仓库地址:[https://github.com/fe-lce/lowcode-code-generator-demo](https://github.com/fe-lce/lowcode-code-generator-demo) diff --git a/docs/docs/guide/create/useEditor.md b/docs/docs/guide/create/useEditor.md index 8df4158a6c..151e6cd5af 100644 --- a/docs/docs/guide/create/useEditor.md +++ b/docs/docs/guide/create/useEditor.md @@ -17,9 +17,11 @@ sidebar_position: 0 npm install -g @alilc/create-element@latest ``` 4. 通过命令行工具创建 + ```bash npm init @alilc/element editor-project-name ``` + 这时会看到一个选项列表 @@ -27,6 +29,7 @@ sidebar_position: 0 选择`编辑器`,并填写对应的问题,即可完成创建。 > 注 @alilc/create-element 版本需 >= 1.0.4,若看不到`编辑器`选项,请重新执行步骤 3 + 5. 进入创建后的目录 ```bash cd editor-project-name @@ -41,7 +44,7 @@ sidebar_position: 0 ``` 执行后如果看到这个界面,说明项目启动成功。您可以继续看后续章节了。本章节后续内容均为高级配置方式。 - ![image.png](https://img.alicdn.com/imgextra/i4/O1CN013qJVoV1OAcFNKFrIQ_!!6000000001665-2-tps-3060-1634.png) +![image.png](https://img.alicdn.com/imgextra/i4/O1CN013qJVoV1OAcFNKFrIQ_!!6000000001665-2-tps-3060-1634.png) ## 方法 2: 使用 UMD 包方式配置 @@ -50,17 +53,27 @@ sidebar_position: 0 ### 引入 UMD 包资源 我们需要在启动前,正确在项目中通过 UMD 包方式直接依赖如下内容: + > 亦可使用异步加载工具,如果您按照正确的顺序进行加载 ```html - + - + - + - + @@ -76,13 +89,20 @@ sidebar_position: 0 - + - + ``` -> 注:如果 unpkg 的服务比较缓慢,您可以使用官方 CDN 来获得确定版本的低代码引擎,如对于引擎的 1.0.18 版本,可用以下官方 CDN 替代 -> - [https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.0.18/dist/js/engine-core.js](https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.0.18/dist/js/engine-core.js) +> 注:如果 unpkg 的服务比较缓慢,您可以使用官方 CDN 来获得确定版本的低代码引擎,如对于引擎的 1.0.18 版本,可用以下官方 CDN 替代 +> +> - [https://uipaas-assets.com/prod/npm/@felce/lowcode-engine/1.0.18/dist/js/engine-core.js](https://uipaas-assets.com/prod/npm/@felce/lowcode-engine/1.0.18/dist/js/engine-core.js) ### 配置打包 @@ -95,7 +115,7 @@ sidebar_position: 0 "react-dom": "var window.ReactDOM", "prop-types": "var window.PropTypes", "@alifd/next": "var window.Next", - "@alilc/lowcode-engine": "var window.AliLowCodeEngine", + "@felce/lowcode-engine": "var window.AliLowCodeEngine", "@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt", "moment": "var window.moment", "lodash": "var window._" @@ -116,17 +136,19 @@ window.AliLowCodeEngine.init(document.getElementById('lce-container'), { ``` 如果您的项目中使用了 TypeScript,您可以通过如下 devDependencies 引入相关包,并获得对应的类型推断。 + ```javascript // package.json { "devDependencies": { - "@alilc/lowcode-engine": "^1.0.0" + "@felce/lowcode-engine": "^1.0.0" } } ``` + ```javascript // src/index.tsx -import { init } from '@alilc/lowcode-engine'; +import { init } from '@felce/lowcode-engine'; init(document.getElementById('lce-container'), { enableCondition: true, @@ -140,7 +162,8 @@ init 的功能包括但不限于: 2. 传递 preference 并设置 plugins 入参; 3. 初始化 Workbench; -> 本节中的低代码编辑器例子可以在 demo 中找到:[https://github.com/alibaba/lowcode-demo/blob/main/demo-general/src/index.ts](https://github.com/alibaba/lowcode-demo/blob/main/demo-general/src/index.ts) +> 本节中的低代码编辑器例子可以在 demo 中找到:[https://github.com/fe-lce/lowcode-demo/blob/main/demo-general/src/index.ts](https://github.com/fe-lce/lowcode-demo/blob/main/demo-general/src/index.ts) ## 配置低代码编辑器 + 详见[低代码扩展简述](/site/docs/guide/expand/editor/summary)章节。 diff --git a/docs/docs/guide/create/useRenderer.md b/docs/docs/guide/create/useRenderer.md index a9fc79909e..ed88c85631 100644 --- a/docs/docs/guide/create/useRenderer.md +++ b/docs/docs/guide/create/useRenderer.md @@ -20,7 +20,7 @@ sidebar_position: 1 [在 Demo 中](https://lowcode-engine.cn/demo/demo-general/index.html),右上角有渲染模块的示例使用方式: ![Mar-13-2022 16-52-49.gif](https://img.alicdn.com/imgextra/i2/O1CN01PRsEl61o7Zct5fJML_!!6000000005178-1-tps-1534-514.gif) -基于官方提供的渲染模块 [@alifd/lowcode-react-renderer](https://github.com/alibaba/lowcode-engine/tree/main/packages/react-renderer),你可以在 React 上下文渲染低代码编辑器产出的页面。 +基于官方提供的渲染模块 [@alifd/lowcode-react-renderer](https://github.com/fe-lce/lowcode-engine/tree/main/packages/react-renderer),你可以在 React 上下文渲染低代码编辑器产出的页面。 ### 构造渲染模块所需数据 @@ -69,24 +69,19 @@ async function getSchemaAndComponents() { ### 进行渲染 拿到 schema 和 components 以后,您可以借由资产包数据和页面数据来完成页面的渲染: + ```tsx import React from 'react'; -import ReactRenderer from '@alilc/lowcode-react-renderer'; +import ReactRenderer from '@felce/lowcode-react-renderer'; const SamplePreview = () => { - return ( - - ); -} + return ; +}; ``` -> 注 1:您可以注意到,此处是依赖了 React 进行渲染的,对于 Vue 形态的渲染或编辑器支持,详见[对应公告](https://github.com/alibaba/lowcode-engine/issues/236)。 +> 注 1:您可以注意到,此处是依赖了 React 进行渲染的,对于 Vue 形态的渲染或编辑器支持,详见[对应公告](https://github.com/fe-lce/lowcode-engine/issues/236)。 > -> 注 2:本节示例可在 Demo 代码里找到更完整的版本:[https://github.com/alibaba/lowcode-demo/blob/main/demo-general/src/preview.tsx](https://github.com/alibaba/lowcode-demo/blob/main/demo-general/src/preview.tsx) - +> 注 2:本节示例可在 Demo 代码里找到更完整的版本:[https://github.com/fe-lce/lowcode-demo/blob/main/demo-general/src/preview.tsx](https://github.com/fe-lce/lowcode-demo/blob/main/demo-general/src/preview.tsx) ## 出码模块 @@ -94,8 +89,7 @@ const SamplePreview = () => { ![Mar-13-2022 16-55-56.gif](https://img.alicdn.com/imgextra/i3/O1CN017CVeka27p3vwrGI1D_!!6000000007845-1-tps-1536-514.gif) -> 本节示例可在出码插件里找到:[https://github.com/alibaba/lowcode-code-generator-demo](https://github.com/alibaba/lowcode-code-generator-demo) - +> 本节示例可在出码插件里找到:[https://github.com/fe-lce/lowcode-code-generator-demo](https://github.com/fe-lce/lowcode-code-generator-demo) ## 低代码的生产和消费流程总览 diff --git a/docs/docs/guide/design/generator.md b/docs/docs/guide/design/generator.md index 2310cb7a5f..885f386c9b 100644 --- a/docs/docs/guide/design/generator.md +++ b/docs/docs/guide/design/generator.md @@ -7,10 +7,10 @@ sidebar_position: 5 ## npm 包与仓库信息 -| **NPM 包** | **代码仓库** | **说明** | -| --- | --- | --- | -| [@alilc/lowcode-code-generator](https://www.npmjs.com/package/@alilc/lowcode-code-generator) | [alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine)(子目录:modules/code-generator)| 出码模块核心库,支持在 node 环境下运行,也提供了浏览器下运行的 standalone 模式 | -| [@alilc/lowcode-plugin-code-generator](https://www.npmjs.com/package/@alilc/lowcode-plugin-code-generator) | [alibaba/lowcode-code-generator-demo](https://github.com/alibaba/lowcode-code-generator-demo) | 出码示例 -- 浏览器端出码插件 | +| **NPM 包** | **代码仓库** | **说明** | +| ---------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | +| [@felce/lowcode-code-generator](https://www.npmjs.com/package/@felce/lowcode-code-generator) | [fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine)(子目录:modules/code-generator) | 出码模块核心库,支持在 node 环境下运行,也提供了浏览器下运行的 standalone 模式 | +| [@alilc/lowcode-plugin-code-generator](https://www.npmjs.com/package/@alilc/lowcode-plugin-code-generator) | [fe-lce/lowcode-code-generator-demo](https://github.com/fe-lce/lowcode-code-generator-demo) | 出码示例 -- 浏览器端出码插件 | ## 出码模块原理 @@ -30,12 +30,15 @@ sidebar_position: 5 出码模块和编译器很类似,都是将代码的一种表现形式转换成另一种表现形式,如: #### 编译器流程 + ![image.png](https://img.alicdn.com/imgextra/i3/O1CN019F21Lb1bsCwvNcWRq_!!6000000003520-2-tps-3228-492.png) #### 出码模块流程 + ![image.png](https://img.alicdn.com/imgextra/i3/O1CN01SEcVta1uLD72W0URZ_!!6000000006020-2-tps-1536-182.png) ### 出码流程详解 + #### 协议解析 协议解析主要是将输入的 schema 解析成更适合出码模块内部使用的数据结构的过程。这样在后面的代码生成过程中就可以直接用这些数据,不必重复解析了。 @@ -61,6 +64,7 @@ sidebar_position: 5 ![](https://img.alicdn.com/imgextra/i4/O1CN01P0Lw7v1lfyWtfQTuR_!!6000000004847-2-tps-994-278.png) #### 代码生成 + 代码生成的流程如下: ![](https://img.alicdn.com/imgextra/i1/O1CN01lhcWBg1RG3nsoSoY2_!!6000000002083-2-tps-1468-464.png) @@ -93,17 +97,18 @@ interface IProjectPlugins { [slotName: string]: BuilderComponentPlugin[]; } ``` + ##### 代码块 代码块是出码产物的最小单元,由出码模块插件产出,多个代码块最后会被组装为代码文件。每个代码块通过 name 描述自己,再通过 linkAfter 描述应该跟在哪些 name 的代码块后面。 ```typescript interface ICodeChunk { - type: ChunkType; // 处理类型 ast | string | json - fileType: string; // 文件类型 js | css | ts ... - name: string; // 代码块名称,与 linkAfter 相关 - subModule?: string; // 模块内文件名,默认是 index - content: ChunkContent; // 代码块内容,数据格式与 type 相关 + type: ChunkType; // 处理类型 ast | string | json + fileType: string; // 文件类型 js | css | ts ... + name: string; // 代码块名称,与 linkAfter 相关 + subModule?: string; // 模块内文件名,默认是 index + content: ChunkContent; // 代码块内容,数据格式与 type 相关 linkAfter: string[]; } ``` diff --git a/docs/docs/guide/design/materialParser.md b/docs/docs/guide/design/materialParser.md index 78936011fd..f77fb291ee 100644 --- a/docs/docs/guide/design/materialParser.md +++ b/docs/docs/guide/design/materialParser.md @@ -2,25 +2,31 @@ title: 入料模块设计 sidebar_position: 2 --- + ## 介绍 -入料模块负责物料接入,通过自动扫描、解析源码组件,产出一份符合《中后台低代码组件描述协议》的** **JSON Schema。这份 Schema 包含基础信息和属性描述信息部分,低代码引擎会基于它们在运行时自动生成一份 configure 配置,用作设置面板展示。 + +入料模块负责物料接入,通过自动扫描、解析源码组件,产出一份符合《中后台低代码组件描述协议》的\*\* \*\*JSON Schema。这份 Schema 包含基础信息和属性描述信息部分,低代码引擎会基于它们在运行时自动生成一份 configure 配置,用作设置面板展示。 ## npm 包与仓库信息 -- npm 包:@alilc/lowcode-material-parser -- 仓库:[https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) 下的 modules/material-parser +- npm 包:@felce/lowcode-material-parser +- 仓库:[https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) 下的 modules/material-parser ## 原理 + 入料模块使用动静态分析结合的方案,动态胜在真实,静态胜在细致,不过全都依赖源码中定义的属性,若未定义,或者定义错误,则无法正确入料。 ### 整体流程 + 大体分为本地化、扫描、解析、转换、校验 5 部分,如下图所示。 ![image.png](https://img.alicdn.com/imgextra/i2/O1CN01sXf5fL1E5RcRxAlM1_!!6000000000300-2-tps-2116-206.png) ### 静态解析 + 在静态分析时,分为 JS 和 TS 两种情况。 #### 静态解析 JS + 在 JS 情况下,基于 react-docgen 进行扩展,自定义了 resolver 及 handler,前者用于寻找组件定义,后者用于解析 propTypes、defaultProps 等信息,整体流程图如下: ![image.png](https://img.alicdn.com/imgextra/i1/O1CN01VrhkEb1R6tsntvGhV_!!6000000002063-2-tps-2176-478.png) @@ -28,6 +34,7 @@ sidebar_position: 2 react-docgen 使用 babel 生成语法树,再使用 ast-types 进行遍历去寻找组件节点及其属性类型定义。原本的 react-docgen 只能解析单文件,且不能解析 IIFE、逗号表达式等语法结构 (一般出现在转码后的代码中)。笔者对其进行改造,使之可以递归解析多文件去查找组件定义,且能够解开 IIFE,以及对逗号表达式进行转换,以方便后续的组件解析。另外,还增加了子组件解析的功能,即类似 `Button.Group = Group` 这种定义。 #### 静态解析 TS + 在 TS 情况下,还要再细分为 TS 源码和 TS 编译后的代码。 TS 源码中,React 组件具有类型签名;TS 编译后的代码中,dts 文件 (如有) 包含全部的 class / interface / type 类型信息。可以从这些类型信息中获取组件属性描述。整体流程图如下: @@ -75,6 +82,7 @@ TypeScript Compiler 会将合成类型的所有属性展开,比如 `boolean | 值得注意的是,有些 js 文件里还会引入 css 文件,而且从笔者了解的情况来看,这种情况在集团内部不在少数。这种组件不配合 webpack 使用,肯定会报错,但是使用 webpack 会明显拖慢速度,所以笔者采用了 sandbox 的方式,对 require 进来的类 css 文件进行 mock。这里,笔者使用了 vm2 这个库,它对 node 自带的 vm 进行了封装,可以劫持文件中的 require 方法。因为 parse-prop-types 的修改在沙箱中会失效,所以笔者也 mock 了组件中的 prop-types 库。 ### 整体大图 + 把上述的静态解析和动态解析流程结合起来,可以得到以下大图。 ![image.png](https://img.alicdn.com/imgextra/i1/O1CN01TA9lQp27QmwVT7WUC_!!6000000007792-2-tps-2658-1072.png) diff --git a/docs/docs/guide/design/renderer.md b/docs/docs/guide/design/renderer.md index 4a8c43f329..022dccd4bb 100644 --- a/docs/docs/guide/design/renderer.md +++ b/docs/docs/guide/design/renderer.md @@ -2,6 +2,7 @@ title: 渲染模块设计 sidebar_position: 4 --- + ## 低代码渲染介绍 @@ -10,13 +11,14 @@ sidebar_position: 4 ## npm 包与仓库信息 -- React 框架渲染 npm 包:@alilc/lowcode-react-renderer -- 仓库:[https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) 下的 - - packages/renderer-core - - packages/react-renderer - - packages/react-simulator-renderer +- React 框架渲染 npm 包:@felce/lowcode-react-renderer +- 仓库:[https://github.com/fe-lce/lowcode-engine](https://github.com/fe-lce/lowcode-engine) 下的 + - packages/renderer-core + - packages/react-renderer + - packages/react-simulator-renderer ## 渲染框架原理 + ### 整体架构 ![image.png](https://img.alicdn.com/imgextra/i1/O1CN01i4IiSR1cMtUFXaWQq_!!6000000003587-2-tps-1686-1062.png) @@ -32,54 +34,65 @@ sidebar_position: 4 这里主要解析一下刚刚提到的架构中的适配层和渲染层。 #### 适配层 + 适配层提供的是各个框架之间的差异项。比如 `React.createElement` 和 `Rax.createElement` 方法是不同的。所以需要在适配层对 API 进行抹平。 ##### React + ```typescript import { createElement } from 'react'; -import { - adapter, -} from '@ali/lowcode-renderer-core'; +import { adapter } from '@ali/lowcode-renderer-core'; adapter.setRuntime({ createElement, }); ``` + ##### Rax + ```typescript import { createElement } from 'rax'; -import { - adapter, -} from '@ali/lowcode-renderer-core'; +import { adapter } from '@ali/lowcode-renderer-core'; adapter.setRuntime({ createElement, }); ``` + 这时,在核心层使用的 `createElement` 会基于使用不同的 renderer 而使用不同的方法,自动适配框架所需的运行时方法。 所需的方法包括: - `setRuntime`:设置运行时相关方法 - - `Component`:组件类,参考 React 的 `Component`。 - - `PureComponent`:组件类,参考 React 的 `PureComponent`。 - - `createContext`:创建一个 `Context` 对象的方法。例如,当 React 渲染一个订阅了这个 `Context` 对象的组件,这个组件会从组件树中离自身最近的那个匹配的 `Provider` 中读取到当前的 `context` 值。 - - `createElement`:创建 `Component` 元素,例如在 React 中即为创建 React 元素。 - - `forwardRef`:ref 转发的方法。Ref 转发是一个可选特性,其允许某些组件接收 ref,并将其向下传递(换句话说,“转发”它)给子组件。 - - `findDOMNode`:是一个访问底层 DOM 节点的方法。如果组件已经被挂载到 DOM 上,此方法会返回浏览器中相应的原生 DOM 元素。 + - `Component`:组件类,参考 React 的 `Component`。 + - `PureComponent`:组件类,参考 React 的 `PureComponent`。 + - `createContext`:创建一个 `Context` 对象的方法。例如,当 React 渲染一个订阅了这个 `Context` 对象的组件,这个组件会从组件树中离自身最近的那个匹配的 `Provider` 中读取到当前的 `context` 值。 + - `createElement`:创建 `Component` 元素,例如在 React 中即为创建 React 元素。 + - `forwardRef`:ref 转发的方法。Ref 转发是一个可选特性,其允许某些组件接收 ref,并将其向下传递(换句话说,“转发”它)给子组件。 + - `findDOMNode`:是一个访问底层 DOM 节点的方法。如果组件已经被挂载到 DOM 上,此方法会返回浏览器中相应的原生 DOM 元素。 - `setRenderers` - - `PageRenderer`:页面渲染的方法。可以定制页面渲染的生命周期,定制导航,定制路由等。 - - `ComponentRenderer`:组件渲染的方法。 - - `BlockRenderer`:区块渲染的方法。 + - `PageRenderer`:页面渲染的方法。可以定制页面渲染的生命周期,定制导航,定制路由等。 + - `ComponentRenderer`:组件渲染的方法。 + - `BlockRenderer`:区块渲染的方法。 #### 渲染层 + ##### React Renderer + 内部的技术栈统一都是 React,大多数适配层的 API 都是按照 React 来设计的,所以对于 React Renderer 来说,需要做的不多。 React Renderer 的代码量很少,主要是将 React API 注册到适配层中。 ```typescript -import React, { Component, PureComponent, createElement, createContext, forwardRef, ReactInstance, ContextType } from 'react'; +import React, { + Component, + PureComponent, + createElement, + createContext, + forwardRef, + ReactInstance, + ContextType, +} from 'react'; import ReactDOM from 'react-dom'; import { adapter, @@ -118,7 +131,9 @@ adapter.setConfigProvider(ConfigProvider); ``` ##### Rax Renderer + Rax 的大多数 API 和 React 基本也是一致的,差异点在于重写了一些方法。 + ```typescript import { Component, PureComponent, createElement, createContext, forwardRef } from 'rax'; import findDOMNode from 'rax-find-dom-node'; @@ -152,8 +167,11 @@ adapter.setRenderers({ ``` ### 多模式渲染 + #### 预览模式渲染 + 预览模式的渲染,主要是通过 Schema、components 即可完成上述的页面渲染能力。 + ```typescript import ReactRenderer from '@ali/lowcode-react-renderer'; import ReactDOM from 'react-dom'; @@ -168,7 +186,7 @@ const schema = { props: { type: 'primary', style: { - color: '#2077ff' + color: '#2077ff', }, }, children: '确定', @@ -180,19 +198,20 @@ const components = { Button, }; -ReactDOM.render(( - -), document.getElementById('root')); +ReactDOM.render( + , + document.getElementById('root'), +); ``` #### 设计模式渲染(Simulator) + 设计模式渲染就是将编排生成的《搭建协议》渲染成视图的过程,视图是可以交互的,所以必须要处理好内部数据流、生命周期、事件绑定、国际化等等。也称为画布的渲染,画布是 UI 编排的核心,它一般融合了页面的渲染以及组件/区块的拖拽、选择、快捷配置。 画布的渲染和预览模式的渲染的区别在于,画布的渲染和设计器之间是有交互的。所以在这里我们新增了一层 `Simulator` 作为设计器和渲染的连接器。 `Simulator` 是将设计器传入的 `DocumentModel` 和组件/库描述转成相应的 Schema 和 组件类。再调用 Render 层完成渲染。我们这里介绍一下它提供的能力。 + ##### 整体架构 + ![image.png](https://img.alicdn.com/imgextra/i2/O1CN017cYBAp1hvJKPUVLbx_!!6000000004339-2-tps-1500-864.png) - `Project`:位于顶层的 Project,保留了对所有文档模型的引用,用于管理应用级 Schema 的导入与导出。 @@ -206,6 +225,7 @@ ReactDOM.render(( - 通用交互模型:内置了拖拽、活跃追踪、悬停探测、剪贴板、滚动、快捷键绑定。 ##### 模拟器介绍 + ![image.png](https://img.alicdn.com/imgextra/i2/O1CN01GF1PMj288kxovvnK8_!!6000000007888-2-tps-1500-740.png) - 运行时环境:从运行时环境来看,目前我们有 React 生态、Rax 生态。而在对外的历程中,我们也会拥有 Vue 生态、Angular 生态等。 diff --git a/docs/docs/guide/design/setter.md b/docs/docs/guide/design/setter.md index 7afbbf034f..62b795d9b7 100644 --- a/docs/docs/guide/design/setter.md +++ b/docs/docs/guide/design/setter.md @@ -15,10 +15,11 @@ sidebar_position: 6 - 样式:展示该物料样式的属性; - 事件:如果该物料有声明事件,则会出现事件面板,用于绑定事件; - 高级:两个逻辑相关的属性,**条件渲染**和**循环。** + ## npm 包与仓库信息 - npm 包:@alilc/lowcode-engine-ext -- 仓库:[https://github.com/alibaba/lowcode-engine-ext](https://github.com/alibaba/lowcode-engine-ext) +- 仓库:[https://github.com/fe-lce/lowcode-engine-ext](https://github.com/fe-lce/lowcode-engine-ext) ## 设置器模块原理 @@ -75,6 +76,7 @@ interface SettingTargetProp extends SettingTarget { ``` ### SettingField 抽象 + ![image.png](https://img.alicdn.com/imgextra/i2/O1CN01D855j01j8sg9GdtJr_!!6000000004504-2-tps-2022-402.png) ```typescript diff --git a/docs/docs/guide/expand/editor/cli.md b/docs/docs/guide/expand/editor/cli.md index 0577a181db..eeb99c3446 100644 --- a/docs/docs/guide/expand/editor/cli.md +++ b/docs/docs/guide/expand/editor/cli.md @@ -2,6 +2,7 @@ title: 低代码生态脚手架 & 调试机制 sidebar_position: 10 --- + ## 脚手架简述 在 fork 低代码编辑器 demo 项目后,您可以直接在项目中任意扩展低代码编辑器。如果您想要将自己的组件/插件/设置器封装成一个独立的 npm 包并提供给社区,您可以使用我们的低代码脚手架建立低代码扩展。 @@ -12,21 +13,24 @@ sidebar_position: 10 > > 中文教程:[https://blog.csdn.net/weixin_45027467/article/details/106862520](https://blog.csdn.net/weixin_45027467/article/details/106862520) - ## 脚手架功能 + ### 脚手架初始化 ```bash npm init @alilc/element your-element-name ``` + 不写 your-element-name 的情况下,则在当前目录创建。 > 注 1:如遇错误提示 `sh: create-element: command not found` 可先执行下述命令 + ```bash npm install -g @alilc/create-element ``` > 注 2:觉得安装速度比较慢的同学,可以设置 npm 国内镜像,如 + ```bash npm init @alilc/element your-element-name --registry=https://registry.npmmirror.com ``` @@ -64,135 +68,140 @@ npm publish ### 组件/插件/Setter 侧 1. 插件/setter 在原有 alt 的配置中添加相关的调试配置 - ```json - // build.json 中 - { - "plugins": [ - [ - "@alilc/build-plugin-alt", - { - "type": "plugin", - "inject": true, // 开启注入调试 - // 配置要打开的页面,在注入调试模式下,不配置此项的话不会打开浏览器 - // 支持直接使用官方 demo 项目:https://lowcode-engine.cn/demo/index.html - "openUrl": "https://lowcode-engine.cn/demo/index.html?debug" - } - ], + +```json +// build.json 中 +{ + "plugins": [ + [ + "@alilc/build-plugin-alt", + { + "type": "plugin", + "inject": true, // 开启注入调试 + // 配置要打开的页面,在注入调试模式下,不配置此项的话不会打开浏览器 + // 支持直接使用官方 demo 项目:https://lowcode-engine.cn/demo/index.html + "openUrl": "https://lowcode-engine.cn/demo/index.html?debug" + } ] - } - ``` + ] +} +``` 2. 组件需先安装 @alilc/build-plugin-alt,再将组件内的 `build.lowcode.js`文件修改如下 - ```javascript - const { library } = require('./build.json'); - - module.exports = { - alias: { - '@': './src', - }, - plugins: [ - [ - // lowcode 的配置保持不变,这里仅为示意。 - '@alifd/build-plugin-lowcode', - { - library, - engineScope: "@alilc" - }, - ], - [ - '@alilc/build-plugin-alt', - { - type: 'component', - inject: true, - library, - // 配置要打开的页面,在注入调试模式下,不配置此项的话不会打开浏览器 - // 支持直接使用官方 demo 项目:https://lowcode-engine.cn/demo/index.html - openUrl: "https://lowcode-engine.cn/demo/index.html?debug" - } - ]], - }; - ``` -3. 本地组件/插件/Setter正常启动调试,在项目的访问地址增加 debug,即可开启注入调试。 - ```url - https://lowcode-engine.cn/demo/demo-general/index.html?debug - ``` +```javascript +const { library } = require('./build.json'); + +module.exports = { + alias: { + '@': './src', + }, + plugins: [ + [ + // lowcode 的配置保持不变,这里仅为示意。 + '@alifd/build-plugin-lowcode', + { + library, + engineScope: '@alilc', + }, + ], + [ + '@alilc/build-plugin-alt', + { + type: 'component', + inject: true, + library, + // 配置要打开的页面,在注入调试模式下,不配置此项的话不会打开浏览器 + // 支持直接使用官方 demo 项目:https://lowcode-engine.cn/demo/index.html + openUrl: 'https://lowcode-engine.cn/demo/index.html?debug', + }, + ], + ], +}; +``` + +3. 本地组件/插件/Setter 正常启动调试,在项目的访问地址增加 debug,即可开启注入调试。 + +```url +https://lowcode-engine.cn/demo/demo-general/index.html?debug +``` ### 项目侧的准备 > 如果你的低代码项目 fork 自官方 demo,那么项目侧的准备已经就绪,不用再看以下内容~ 1. 安装 @alilc/lowcode-plugin-inject - ```bash - npm i @alilc/lowcode-plugin-inject --save-dev - ``` + +```bash +npm i @alilc/lowcode-plugin-inject --save-dev +``` 2. 在引擎初始化侧引入插件 - ```typescript - import Inject, { injectAssets } from '@alilc/lowcode-plugin-inject'; - import { IPublicModelPluginContext } from '@alilc/lowcode-types'; - - export default async () => { - // 注意 Inject 插件必须在其他插件前注册,且所有插件的注册必须 await - await plugins.register(Inject); - await plugins.register(OtherPlugin); - await plugins.register((ctx: IPublicModelPluginContext) => { - return { - name: "editor-init", - async init() { - // 设置物料描述前,使用插件提供的 injectAssets 进行处理 - const { material, project } = ctx; - material.setAssets(await injectAssets(assets)); - }, - }; - }); - } - ``` + +```typescript +import Inject, { injectAssets } from '@alilc/lowcode-plugin-inject'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; + +export default async () => { + // 注意 Inject 插件必须在其他插件前注册,且所有插件的注册必须 await + await plugins.register(Inject); + await plugins.register(OtherPlugin); + await plugins.register((ctx: IPublicModelPluginContext) => { + return { + name: 'editor-init', + async init() { + // 设置物料描述前,使用插件提供的 injectAssets 进行处理 + const { material, project } = ctx; + material.setAssets(await injectAssets(assets)); + }, + }; + }); +}; +``` 3. 在 saveSchema 时过滤掉插入的 url,避免影响渲染态 - ```typescript - import { filterPackages } from '@alilc/lowcode-plugin-inject'; - export const saveSchema = async () => { - // ... - const packages = await filterPackages(editor.get('assets').packages); - window.localStorage.setItem( - 'packages', - JSON.stringify(packages), - ); - // ... - }; - ``` + +```typescript +import { filterPackages } from '@alilc/lowcode-plugin-inject'; +export const saveSchema = async () => { + // ... + const packages = await filterPackages(editor.get('assets').packages); + window.localStorage.setItem('packages', JSON.stringify(packages)); + // ... +}; +``` 4. 如果希望预览态也可以注入调试组件,则需要在 preview 逻辑里插入组件 - ```javascript - import { injectComponents } from '@alilc/lowcode-plugin-inject'; - async function init() { - // 在传递给 ReactRenderer 前,先通过 injectComponents 进行处理 - const components = await injectComponents(buildComponents(libraryMap, componentsMap)); - // ... - } - ``` +```javascript +import { injectComponents } from '@alilc/lowcode-plugin-inject'; + +async function init() { + // 在传递给 ReactRenderer 前,先通过 injectComponents 进行处理 + const components = await injectComponents(buildComponents(libraryMap, componentsMap)); + // ... +} +``` 注:若控制台出现如下错误,直接访问一次该 url 即可~ ![image.png](https://img.alicdn.com/imgextra/i1/O1CN01cvKmeK1saCqpIxbLW_!!6000000005782-2-tps-1418-226.png) - ## Meta 信息 + meta 信息是放在生态元素 package.json 中的一小段 json,用户可以通过 meta 了解到这个元素的一些基本信息,如元素类型,一些入口信息等。 ```typescript interface LcMeta { - type: 'plugin' | 'setter' | 'component'; // 元素类型,尚未实现 - pluginName: string; // 插件名,仅插件包含 + type: 'plugin' | 'setter' | 'component'; // 元素类型,尚未实现 + pluginName: string; // 插件名,仅插件包含 meta: { - dependencies: string[]; // 插件依赖的其他插件列表,仅插件包含 + dependencies: string[]; // 插件依赖的其他插件列表,仅插件包含 engines: { - lowcodeEngine: string; // 适配的引擎版本 - } - prototype: string; // 物料描述入口,仅组件包含,尚未实现 - prototypeView: string; // 物料设计态入口,仅组件包含,尚未实现 - } + lowcodeEngine: string; // 适配的引擎版本 + }; + prototype: string; // 物料描述入口,仅组件包含,尚未实现 + prototypeView: string; // 物料设计态入口,仅组件包含,尚未实现 + }; } ``` diff --git a/docs/docs/guide/expand/editor/graph.md b/docs/docs/guide/expand/editor/graph.md index a45f34baf0..932cce450f 100644 --- a/docs/docs/guide/expand/editor/graph.md +++ b/docs/docs/guide/expand/editor/graph.md @@ -2,47 +2,73 @@ title: 图编排扩展 sidebar_position: 8 --- + ## 项目运行 + ### 前置准备 + 1. 参考 https://lowcode-engine.cn/site/docs/guide/quickStart/start 2. 参考至Demo下载 https://lowcode-engine.cn/site/docs/guide/quickStart/start#%E4%B8%8B%E8%BD%BD-demo + ### 选择demo-graph-x6 + 在根目录下执行: + ```bash cd demo-graph-x6 ``` + ### 安装依赖 + 在 lowcode-demo/demo-graph-x6目录下执行: + ```bash npm install ``` + ### 启动Demo + 在 lowcode-demo/demo-graph-x6 目录下执行: + ```bash npm run start ``` + 之后就可以通过 http://localhost:5556/ 来访问我们的 DEMO 了。 ## 认识Demo + 这里的Demo即通过图编排引擎加入了几个简单的物料而来,已经是可以面向真是用户的产品界面。 ![image.png](https://img.alicdn.com/imgextra/i1/O1CN016TbCI31hM2sJy8qkR_!!6000000004262-2-tps-5120-2726.png) + ### 区域组成 + #### 顶部:操作区​ + - 右侧:保存到本地、重置页面、自定义按钮 + #### 顶部:工具区 + - 左侧:删除、撤销、重做、放大、缩小 + #### 左侧:面板与操作区​ + - 物料面板:可以查找节点,并在此拖动节点到编辑器画布中 + #### 中部:可视化页面编辑画布区域​ + - 点击节点/边在右侧面板中能够显示出对应组件的属性配置选项 - 拖拽修改节点的排列顺序 + #### 右侧:组件级别配置​ + - 选中的组件:从页面开始一直到当前选中的节点/边位置,点击对应的名称可以切换到对应的节点上 - 选中组件的配置:属性:节点的基础属性值设置 > 每个区域的组成都可以被替换和自定义来生成开发者需要的业务产品。 ## 目录介绍 + ![image.png](https://img.alicdn.com/imgextra/i3/O1CN01Luc8gr1tLq5QTbpb9_!!6000000005886-0-tps-832-1522.jpg) - public:与其他demo保持一致,均是lowcode engine所必要依赖 @@ -51,6 +77,7 @@ npm run start - services:mock数据,真实场景中可能为异步获取数据 ## 开发插件 + ```typescript function pluginX6DesignerExtension(ctx: IPublicModelPluginContext) { return { @@ -104,12 +131,15 @@ pluginX6DesignerExtension.pluginName = 'plugin-x6-designer-extension'; export default pluginX6DesignerExtension; ``` + x6Designer为图实例暴露出来的一些接口,可基于此进行一些图的必要插件的封装,整个插件的封装完全follow低代码引擎的插件,详情可参考 https://lowcode-engine.cn/site/docs/guide/expand/editor/pluginWidget ## 开发物料 + ```bash npm init @alilc/element your-material-demo ``` + ![image.png](https://img.alicdn.com/imgextra/i3/O1CN01DCCqO82ADuhS8ztCt_!!6000000008170-2-tps-546-208.png) 仓库初始化完成 @@ -119,37 +149,44 @@ npm init @alilc/element your-material-demo 图物料与低代码的dom场景存在画布的差异,因此暂不支持物料单独调试,须通过项目demo进行物料调试 ### 资产描述 + ```bash npm run lowcode:build ``` + 如果物料是个React组件,则在执行上述命令时会自动生成对应的meta.ts,但图物料很多时候并非一个React组件,因此须手动生产meta.ts -可参考: https://github.com/alibaba/lowcode-materials/blob/main/packages/graph-x6-materials/lowcode/send-email/meta.ts +可参考: https://github.com/fe-lce/lowcode-materials/blob/main/packages/graph-x6-materials/lowcode/send-email/meta.ts 同时会自动生成物料描述文件 ### 物料调试 + #### 物料侧 + 物料想要支持被项目动态inject调试,须在build.lowcode.js中加入 + ```javascript [ '@alilc/build-plugin-alt', { type: 'component', inject: true, - library + library, }, -] +]; ``` + ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01HyXfL12992sDkOmOg_!!6000000008024-0-tps-5120-2824.jpg) 本地启动 + ```bash npm run lowcode:dev ``` + #### 项目侧 + 通过@alilc/lce-graph-core加载物料的天然支持了debug,因此无须特殊处理。 若项目中自行加载,则参考 https://lowcode-engine.cn/site/docs/guide/expand/editor/cli 项目访问地址后拼接query "?debug"即可进入物料调试 ![image.png](https://img.alicdn.com/imgextra/i2/O1CN01ke58hT1aRoYJzkutk_!!6000000003327-2-tps-5120-2790.png) - - diff --git a/docs/docs/guide/expand/editor/material.md b/docs/docs/guide/expand/editor/material.md index 6e4979553b..6b5dae8704 100644 --- a/docs/docs/guide/expand/editor/material.md +++ b/docs/docs/guide/expand/editor/material.md @@ -2,7 +2,9 @@ title: 物料扩展 sidebar_position: 1 --- + ## 物料简述 + 物料是页面搭建的原料,按照粒度可分为组件、区块和模板: 1. 组件:组件是页面搭建最小的可复用单元,其只对外暴露配置项,用户无需感知其内部实现; @@ -10,11 +12,14 @@ sidebar_position: 1 3. 模板:模板和区块类似,也是一段符合低代码协议的 schema,不过其根节点的 componentName 需固定为 Page,它常常用于初始化一个页面; 低代码编辑器中的物料需要进行一定的配置和处理,才能让用户在低代码平台使用起来。这个过程中,需要一份一份配置文件,也就是资产包。资产包文件中,针对每个物料定义了它们在低代码编辑器中的使用描述。 + ## 资产包配置 + ### 什么是低代码资产包 + ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01SQJfxh1Y8uwDXksaK_!!6000000003015-2-tps-3068-1646.png) 在低代码 Demo 中,我们可以看到,组件面板不只提供一个组件,组件是以集合的形式提供给低代码平台的,而低代码资产包正是这些组件构成集合的形式。 -**_它背后的 Interface,_**[**_在引擎中的定义摘抄如下_**](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/assets.ts)**_:_** +**_它背后的 Interface,_**[**_在引擎中的定义摘抄如下_**](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/assets.ts)**_:_** ```typescript export interface Assets { @@ -32,46 +37,59 @@ export interface ComponentSort { export interface RemoteComponentDescription { exportName: string; // 组件描述导出名字,可以通过 window[exportName] 获取到组件描述的 Object 内容; url: string; // 组件描述的资源链接; - package: { // 组件 (库) 的 npm 信息; + package: { + // 组件 (库) 的 npm 信息; npm: string; - } + }; } ``` + 资产包协议 TS 描述 + ### Demo 中的资产包 + 在 Demo 项目中,自带了一份默认的资产包: -> [https://github.com/alibaba/lowcode-demo/blob/main/demo-general/src/services/assets.json](https://github.com/alibaba/lowcode-demo/blob/main/demo-general/src/services/assets.json) + +> [https://github.com/fe-lce/lowcode-demo/blob/main/demo-general/src/services/assets.json](https://github.com/fe-lce/lowcode-demo/blob/main/demo-general/src/services/assets.json) 这份资产包里的物料是我们内部沉淀出的,用户可以通过这套资产包体验引擎提供的搭建、配置能力。 **_在项目中正常注册资产包:_** + ```typescript -import { material } from '@alilc/lowcode-engine'; +import { material } from '@felce/lowcode-engine'; // 以任何方式引入 assets material.setAssets(assets); ``` + **_以支持调试的方式注册资产包:_** + > 这样启动并部署出来的项目,可以通过在预览地址加上 ?debug 来调试本地物料。 > 例如: +> > - 通过插件初始化一个物料 > - 按照参考文章配置物料支持调试 > - 启动物料 > - 访问:[https://lowcode-engine.cn/demo/demo-general/index.html?debug](https://lowcode-engine.cn/demo/demo-general/index.html) > -详细参考:[低代码生态脚手架 & 调试机制](https://lowcode-engine.cn/site/docs/guide/expand/editor/cli) +> 详细参考:[低代码生态脚手架 & 调试机制](https://lowcode-engine.cn/site/docs/guide/expand/editor/cli) ```typescript -import { material } from '@alilc/lowcode-engine'; +import { material } from '@felce/lowcode-engine'; import Inject, { injectAssets } from '@alilc/lowcode-plugin-inject'; await material.setAssets(await injectAssets(assets)); ``` ### 手工配置资产包 -参考 Demo 中的[基础 Fusion Assets 定义](https://github.com/alibaba/lowcode-demo/blob/main/demo-basic-fusion/src/services/assets.json),如果我们修改 assets.json,我们就能做到配置资产包: + +参考 Demo 中的[基础 Fusion Assets 定义](https://github.com/fe-lce/lowcode-demo/blob/main/demo-basic-fusion/src/services/assets.json),如果我们修改 assets.json,我们就能做到配置资产包: - packages 对象:我们需要在其中定义这个包的获取方式,如果不定义,就不会被低代码引擎动态加载并对应上组件实例。定义方式是 UMD 的包,低代码引擎会尝试在 window 上寻找对应 library 的实例; - components 对象:我们需要在其中定义物料描述,物料描述我们将在下一节继续讲解。 + ## 物料描述配置 + ### 什么是物料描述 + 在低代码平台中,用户是不同的,有可能是开发、测试、运营、设计,也有可能是销售、行政、HR 等等各种角色。他们大多数不具备专业的前端开发知识,对于低代码平台来说,我们使用组件的流程如下: 1. 用户通过拖拽/选择组件,在画布中看到组件; @@ -88,7 +106,9 @@ await material.setAssets(await injectAssets(assets)); 3. 能力配置/体验增强:推荐用于优化搭建产品编辑体验,定制编辑能力的配置信息。 因此,我们设计了[**《中后台低代码组件描述协议》**](/site/docs/specs/material-spec)来描述一个低代码编辑器中可被配置的内容。 + ### Demo 中的物料描述 + 我们可以从 Demo 中的 assets.json 找到如下三个物料描述: - @alifd/pro-layout:布局组件,放在`window.AlifdProLayoutMeta`,[meta 文件地址](https://alifd.alicdn.com/npm/@alifd/pro-layout@1.0.1-beta.5/build/lowcode/meta.js); @@ -96,36 +116,50 @@ await material.setAssets(await injectAssets(assets)); - @alilc/lowcode-materials:原子组件,放在 `window.AlilcLowcodeMaterialsMeta`,[meta 文件地址](https://alifd.alicdn.com/npm/@alilc/lowcode-materials@1.0.1/build/lowcode/meta.js); **_引擎中,会尝试调用对应 meta 文件,并注入到全局:_** + ```tsx const src = 'https://alifd.alicdn.com/npm/@alifd/pro-layout@1.0.1-beta.5/build/lowcode/meta.js'; const script = document.createElement('script'); script.src = src; document.head.appendChild(script); ``` + 然后在 window 上就能拿到对应的物料描述内容了: ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01DHSEOH1RwCEq19Ro9_!!6000000002175-2-tps-1896-1138.png) 手工配置物料描述时,可以用这样的方式参考一下 Demo 中的物料描述是如何实现的。 + ### 手工配置物料描述 + 详见:“物料描述详解”章节。 + ## 物料的低代码开发 + > _**注意:引擎提供的 cli 并未对 windows 系统做适配,windows 环境必须使用 **_[_**WSL**_](https://docs.microsoft.com/zh-cn/windows/wsl/install)_**,其他终端不保证能正常运行**_ 您可以通过本节内容,完成一个组件在低代码编辑器中的配置和调试。 + ### 前言(必读) -引擎提供的物料开发脚手架内置了**_入料模块_**,初始化的时候会自动根据源码解析出一份_**低代码描述**_,但是从源码解析出来的低代码描述让用户直接使用是不够精细的,因为源码包含的信息不够,它没办法完全包含配置项的交互; + +引擎提供的物料开发脚手架内置了**_入料模块_**,初始化的时候会自动根据源码解析出一份**_低代码描述_**,但是从源码解析出来的低代码描述让用户直接使用是不够精细的,因为源码包含的信息不够,它没办法完全包含配置项的交互; ![image.png](https://img.alicdn.com/imgextra/i1/O1CN010t0YzC1znDPQB1LUA_!!6000000006758-2-tps-802-1830.png) 比如设计师出了上面的设计稿,这里面除了有哪些 props 可被配置,通过哪个设置器配置,还包含了 props 之间的聚合、排序,甚至有自定义 setter,这些信息源码里是不具备的,需要在低代码描述里进行开发; **_因此我们建议只把 cli 初始化的低代码描述作为启动,要根据用户习惯对配置项进行设计,然后人工地去开发调试直接的低代码描述。_** + ### 新开发组件 + #### 组件项目初始化 + ```bash npm init @alilc/element your-material-name ``` + #### 选择组件类型 + > 组件 -> <组件组织方式> ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01BTiMt51iLPtzDbuh8_!!6000000004396-2-tps-1596-464.png) 这里我们选择 react-组件库,之后便生出我们的组件库项目,目录结构如下: + ``` my-materials ├── README.md @@ -146,7 +180,9 @@ my-materials │ │ └── package.json // 【必选】 └── └── ExampleComponent2 // 业务组件2 ``` + #### 组件开发与调试 + ```bash # 安装依赖 npm install @@ -157,6 +193,7 @@ npm run lowcode:dev # 构建低代码产物 npm run lowcode:build ``` + 执行上述命令后会在组件 (库) 根目录生成一个 `lowcode` 文件夹,里面会包含每个组件的低代码描述: ![image.png](https://img.alicdn.com/imgextra/i2/O1CN016m7gOK1DvpIcnlTvY_!!6000000000279-2-tps-1446-906.png) @@ -167,44 +204,57 @@ npm run lowcode:build - 设置组件的 setter(上一个章节介绍的设置器,也可以定制设置器用到物料中); - 新增组件配置项; - 更改当前配置项; + #### 配置示例 + 隐藏一个 prop + ```typescript { name: 'dataSource', condition: () => false, } ``` + 展示样式 + ```typescript { name: 'dataSource', display: 'accordion' | 'inline' | 'block' | 'plain' | 'popup' | 'entry', // 常用的是 inline(默认), block、entry } ``` + #### 编辑态视图 + 用户可以在 lowcode/ 目录下新增 view.tsx 来增加编辑态视图。编辑态视图用于在编辑态时展示与真实预览不一样的视图。 view.tsx 输出的也是一个 React 组件。 注意:如果是单组件,而非组件库模式的话,view.tsx 应置于 lowcode 而非 lowcode/ 目录下 - #### 发布组件 + ```bash # 在组件根目录下,执行 $ npm publish ``` + ### 现存组件低代码化 + 组件低代码化是指,在引入低代码平台之前,我们大多数都是使用源码开发的组件,也就是 ProCode 组件。 在引入低代码平台之后,原来的源码组件是需要转化为低代码物料,这样才能在低代码平台进行消费。 所以接下来会说明,对于已有的源码组件,我们如何把它低代码化。 + #### 配置低代码开发环境 + 在您的组件开发环境中,安装 [build-scripts](https://github.com/ice-lab/build-scripts) 和它的低代码开发插件: + ```bash npm install -D @alifd/build-plugin-lowcode @alib/build-scripts --save-dev ``` + 新增 build-scripts 配置文件:build.lowcode.js ```javascript @@ -214,21 +264,24 @@ module.exports = { }, plugins: [ [ - "@alifd/build-plugin-lowcode", + '@alifd/build-plugin-lowcode', { engineScope: '@alilc', - } - ] + }, + ], ], }; - ``` + 在 package.json 中定义低代码开发相关命令 + ```javascript "lowcode:dev": "build-scripts start --config ./build.lowcode.js", "lowcode:build": "build-scripts build --config ./build.lowcode.js", ``` + ![image.png](https://img.alicdn.com/imgextra/i2/O1CN014iSa1P1dNdkUUtoMm_!!6000000003724-2-tps-1830-822.png) + #### 开发调试 ```bash @@ -246,47 +299,56 @@ npm run lowcode:build ``` #### 发布组件 + ```bash # 在组件根目录下,执行 npm publish ``` ## 在项目中引入组件 (库) + > 以下内容可观看[《阿里巴巴低代码引擎项目实战 (3)-自定义组件接入》](https://www.bilibili.com/video/BV1dZ4y1m76S/)直播回放 对于平台或者用户来说,可能所需要的组件集合是不同的。如果需要自定义组件集合,就需要定制资产包,定制的资产包是配置了一系列组件的,将这份资产包用于引擎即可在引擎中使用自定义的组件集合。 ### 管理一份资产包 + 项目中使用的组件相关资源都需要在资产包中定义,那么我们自己开发的组件库如果要在项目中使用,只需要把组件构建好的相关资源 merge 到 assets.json 中就可以; #### 自定义组件加入到资产包 + 通过官方脚手架自定义组件构建发布之后,npm 包里会出现一个 `build/lowcode/assets-prod.json`文件,我们只需要把该文件的内容 merge 到项目的 assets.json 中就可以; #### 资产包托管 -- 最简单的方式就是类似[引擎 demo 项目](https://github.com/alibaba/lowcode-demo/blob/main/demo-general/src/services/assets.json)的做法,在项目中维护一份 assets.json,新增组件或者组件版本更新都需要修改这份资产包; +- 最简单的方式就是类似[引擎 demo 项目](https://github.com/fe-lce/lowcode-demo/blob/main/demo-general/src/services/assets.json)的做法,在项目中维护一份 assets.json,新增组件或者组件版本更新都需要修改这份资产包; - 灵活一点的做法是通过 oss 等服务维护一份远程可配置的 assets.json,新增组件或者组件更新只需要修改这份远程的资产包,项目无需更新; - 再高级一点的做法是实现一个资产包管理的服务,能够通过用户界面去更新资产包的内容; ### 在项目中引入资产包 + ```typescript -import { material, plugins } from '@alilc/lowcode-engine'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { material, plugins } from '@felce/lowcode-engine'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; // 动态加载 assets -plugins.register((ctx: IPublicModelPluginContext) => { - return { - name: 'ext-assets', - async init() { - try { - // 将下述链接替换为您的物料即可。无论是通过 utils 从物料中心引入,还是通过其他途径如直接引入物料描述 - const res = await window.fetch('https://fusion.alicdn.com/assets/default@0.1.95/assets.json'); - const assets = await res.text(); - material.setAssets(assets); - } catch (err) { - console.error(err); - } - }, - } -}).catch(err => console.error(err)); +plugins + .register((ctx: IPublicModelPluginContext) => { + return { + name: 'ext-assets', + async init() { + try { + // 将下述链接替换为您的物料即可。无论是通过 utils 从物料中心引入,还是通过其他途径如直接引入物料描述 + const res = await window.fetch( + 'https://fusion.alicdn.com/assets/default@0.1.95/assets.json', + ); + const assets = await res.text(); + material.setAssets(assets); + } catch (err) { + console.error(err); + } + }, + }; + }) + .catch((err) => console.error(err)); ``` diff --git a/docs/docs/guide/expand/editor/metaSpec.md b/docs/docs/guide/expand/editor/metaSpec.md index dda16a9cb3..36a762c018 100644 --- a/docs/docs/guide/expand/editor/metaSpec.md +++ b/docs/docs/guide/expand/editor/metaSpec.md @@ -2,6 +2,7 @@ title: 物料描述详解 sidebar_position: 2 --- + ## 物料描述概述 中后台前端体系中,存在大量的组件,程序员可以通过阅读文档,知悉组件的用法。可是搭建平台无法理解 README,而且很多时候,README 里并没有属性列表。这时,我们需要一份额外的描述,来告诉低代码搭建平台,组件接受哪些属性,又是该用怎样的方式来配置这些属性,于是,[**《中后台低代码组件描述协议》**](/site/docs/specs/material-spec)应运而生。协议主要包含三部分:基础信息、属性信息 props、能力配置/体验增强 configure。 @@ -14,9 +15,10 @@ sidebar_position: 2 ## 自动生成物料描述 -可以使用官方提供的 `@alilc/lowcode-material-parser` 解析本地组件,自动生成物料描述。把物料描述放到资产包定义中,就能让低代码引擎理解如何制作物料。详见上一个章节“物料扩展”。 +可以使用官方提供的 `@felce/lowcode-material-parser` 解析本地组件,自动生成物料描述。把物料描述放到资产包定义中,就能让低代码引擎理解如何制作物料。详见上一个章节“物料扩展”。 下面以某个组件代码片段为例: + ```typescript // /path/to/component import { PureComponent } from 'react'; @@ -28,8 +30,8 @@ export default class FusionForm extends PureComponent { static defaultProps = { name: '张三', age: 18, - friends: ['李四','王五','赵六'], - } + friends: ['李四', '王五', '赵六'], + }; static propTypes = { /** @@ -43,7 +45,7 @@ export default class FusionForm extends PureComponent { /** * 这是用于描述好友列表 */ - friends: PropTypes.array + friends: PropTypes.array, }; render() { @@ -55,7 +57,7 @@ export default class FusionForm extends PureComponent { 引入 parse 工具自动解析 ```typescript -import parse from '@alilc/lowcode-material-parser'; +import parse from '@felce/lowcode-material-parser'; (async () => { const result = await parse({ entry: '/path/to/component' }); console.log(JSON.stringify(result, null, 2)); @@ -97,11 +99,7 @@ import parse from '@alilc/lowcode-material-parser'; "name": "friends", "propType": "array", "description": "这是用于描述好友列表", - "defaultValue": [ - "李四", - "王五", - "赵六" - ] + "defaultValue": ["李四", "王五", "赵六"] } ] } @@ -153,11 +151,7 @@ import parse from '@alilc/lowcode-material-parser'; "name": "friends", "propType": "array", "description": "这是用于描述好友列表", - "defaultValue": [ - "李四", - "王五", - "赵六" - ] + "defaultValue": ["李四", "王五", "赵六"] } ], // 手工增加的 size 属性 @@ -168,7 +162,7 @@ import parse from '@alilc/lowcode-material-parser'; "title": "尺寸", "name": "size", "setter": { - "componentName": 'RadioGroupSetter', + "componentName": "RadioGroupSetter", "isRequired": true, "props": { "options": [ @@ -176,7 +170,7 @@ import parse from '@alilc/lowcode-material-parser'; { "title": "中", "value": "normal" }, { "title": "小", "value": "small" } ] - }, + } } } ] @@ -287,10 +281,12 @@ import parse from '@alilc/lowcode-material-parser'; ```javascript { configure: { - props: [{ - description: '标签文本', - display: 'inline', - }] + props: [ + { + description: '标签文本', + display: 'inline', + }, + ]; } } ``` @@ -302,10 +298,12 @@ import parse from '@alilc/lowcode-material-parser'; ```javascript { configure: { - props: [{ - description: '高级', - display: 'block', - }] + props: [ + { + description: '高级', + display: 'block', + }, + ]; } } ``` @@ -317,10 +315,12 @@ import parse from '@alilc/lowcode-material-parser'; ```javascript { configure: { - props: [{ - description: '表单项配置', - display: 'accordion', - }] + props: [ + { + description: '表单项配置', + display: 'accordion', + }, + ]; } } ``` @@ -329,16 +329,17 @@ import parse from '@alilc/lowcode-material-parser'; ![image.png](https://img.alicdn.com/imgextra/i4/O1CN01zkjBak1YY6igYUO1n_!!6000000003070-2-tps-796-424.png) - ![image.png](https://img.alicdn.com/imgextra/i3/O1CN01lmuRTl1LOPKMnsfLJ_!!6000000001289-2-tps-794-632.png) ```javascript { configure: { - props: [{ - description: '风格与样式', - display: 'entry', - }] + props: [ + { + description: '风格与样式', + display: 'entry', + }, + ]; } } ``` @@ -350,15 +351,16 @@ import parse from '@alilc/lowcode-material-parser'; ```javascript { configure: { - props: [{ - description: '返回上级', - display: 'plain', - }] + props: [ + { + description: '返回上级', + display: 'plain', + }, + ]; } } ``` - ### 进阶配置 #### 组件的 children 属性允许传入 ReactNode @@ -401,6 +403,7 @@ import parse from '@alilc/lowcode-material-parser'; }, } ``` + #### 组件的非 children 属性允许传入 ReactNode 这就需要使用 `SlotSetter` 开启插槽了,如下面示例,给 Tab 的 title 开启插槽,允许拖拽组件 @@ -410,25 +413,21 @@ import parse from '@alilc/lowcode-material-parser'; ```json { // ... - configure: { - isExtend: true, - props: [ + "configure": { + "isExtend": true, + "props": [ { - title: '选项卡标题', - name: 'title', - setter: { - componentName: 'MixedSetter', - props: { - setters: [ - 'StringSetter', - 'SlotSetter', - 'VariableSetter', - ], - }, - }, - }, - ], - }, + "title": "选项卡标题", + "name": "title", + "setter": { + "componentName": "MixedSetter", + "props": { + "setters": ["StringSetter", "SlotSetter", "VariableSetter"] + } + } + } + ] + } } ``` @@ -465,7 +464,7 @@ import parse from '@alilc/lowcode-material-parser'; } // BackwardSetter -import { SettingTarget, DynamicSetter } from '@alilc/lowcode-types'; +import { SettingTarget, DynamicSetter } from '@felce/lowcode-types'; const BackwardSetter: DynamicSetter = (target: SettingTarget) => { return { componentName: ( @@ -501,7 +500,7 @@ const BackwardSetter: DynamicSetter = (target: SettingTarget) => { // direction 为 hoz 则展示当前 prop 配置 condition: (target) => { return target.getProps().getPropValue('direction') === 'hoz'; - } + }; } ``` diff --git a/docs/docs/guide/expand/editor/parts/partsassets.md b/docs/docs/guide/expand/editor/parts/partsassets.md index 00670ecadc..f400086969 100644 --- a/docs/docs/guide/expand/editor/parts/partsassets.md +++ b/docs/docs/guide/expand/editor/parts/partsassets.md @@ -48,25 +48,27 @@ sidebar_position: 4 构建历史界面会显示当前资产包所有的构建历史记录,表格状态栏展示了构建的状态:`成功`,`失败`,`正在运行` 三种状态,操作列可以在构建成功时复制或者下载资产包结果 ## 使用资产包 -你可以在 [lowcode-demo](https://github.com/alibaba/lowcode-demo) 中直接引用,可直接替换 demo 中原来的资产包文件: -例如,在 [demo-lowcode-component](https://github.com/alibaba/lowcode-demo/tree/main/demo-lowcode-component) 中,直接用你的资产包文件替换文件[assets.json](https://github.com/alibaba/lowcode-demo/blob/main/demo-lowcode-component/src/services/assets.json),即可快速使用自己的物料了。 + +你可以在 [lowcode-demo](https://github.com/fe-lce/lowcode-demo) 中直接引用,可直接替换 demo 中原来的资产包文件: +例如,在 [demo-lowcode-component](https://github.com/fe-lce/lowcode-demo/tree/main/demo-lowcode-component) 中,直接用你的资产包文件替换文件[assets.json](https://github.com/fe-lce/lowcode-demo/blob/main/demo-lowcode-component/src/services/assets.json),即可快速使用自己的物料了。 ### 在编辑器中使用资产包 + 在使用含有低代码组件的资产包注意 注意引擎版本必须大于等于 `1.1.0-beta.9`。 -然后直接替换 [lowcode-demo](https://github.com/alibaba/lowcode-demo) demo 中的 `assets.json` 文件即可。 +然后直接替换 [lowcode-demo](https://github.com/fe-lce/lowcode-demo) demo 中的 `assets.json` 文件即可。 ### 在预览中使用资产包 -在预览中使用资产包的整体思路是从 `资产包` 中提取并转换出 `ReactRenderer` 渲染所需要的 react 组件列表 (`components` 参数),然后将 `schema` 以及 `components` 传入到 `ReactRenderer` 中进行渲染,需要注意的是,在 `资产包` 的转换过程中,我们也需要将 `低代码组件` 转换成 react 组件,具体逻辑可以参考下 [demo-lowcode-component](https://github.com/alibaba/lowcode-demo/tree/main/demo-lowcode-component) 中 `src/parse-assets.ts` 文件的实现。 -基于资产包进行预览的整体逻辑如下: [详见](https://github.com/alibaba/lowcode-demo/blob/main/demo-lowcode-component/src/preview.tsx): + +在预览中使用资产包的整体思路是从 `资产包` 中提取并转换出 `ReactRenderer` 渲染所需要的 react 组件列表 (`components` 参数),然后将 `schema` 以及 `components` 传入到 `ReactRenderer` 中进行渲染,需要注意的是,在 `资产包` 的转换过程中,我们也需要将 `低代码组件` 转换成 react 组件,具体逻辑可以参考下 [demo-lowcode-component](https://github.com/fe-lce/lowcode-demo/tree/main/demo-lowcode-component) 中 `src/parse-assets.ts` 文件的实现。 +基于资产包进行预览的整体逻辑如下: [详见](https://github.com/fe-lce/lowcode-demo/blob/main/demo-lowcode-component/src/preview.tsx): + ```ts import ReactDOM from 'react-dom'; import React, { useState } from 'react'; import { Loading } from '@alifd/next'; -import ReactRenderer from '@alilc/lowcode-react-renderer'; +import ReactRenderer from '@felce/lowcode-react-renderer'; import { createFetchHandler } from '@alilc/lowcode-datasource-fetch-handler'; -import { - getProjectSchemaFromLocalStorage, -} from './services/mockService'; +import { getProjectSchemaFromLocalStorage } from './services/mockService'; import assets from './services/assets.json'; import { parseAssets } from './parse-assets'; @@ -125,11 +127,16 @@ const SamplePreview = () => { ReactDOM.render(, document.getElementById('ice-container')); ``` -从资产包中解析 react 组件列表的逻辑如下,[详见](https://github.com/alibaba/lowcode-demo/blob/main/demo-lowcode-component/src/parse-assets.ts): +从资产包中解析 react 组件列表的逻辑如下,[详见](https://github.com/fe-lce/lowcode-demo/blob/main/demo-lowcode-component/src/parse-assets.ts): + ```ts -import { ComponentDescription, ComponentSchema, RemoteComponentDescription } from '@alilc/lowcode-types'; -import { buildComponents, AssetsJson, AssetLoader } from '@alilc/lowcode-utils'; -import ReactRenderer from '@alilc/lowcode-react-renderer'; +import { + ComponentDescription, + ComponentSchema, + RemoteComponentDescription, +} from '@felce/lowcode-types'; +import { buildComponents, AssetsJson, AssetLoader } from '@felce/lowcode-utils'; +import ReactRenderer from '@felce/lowcode-react-renderer'; import { injectComponents } from '@alilc/lowcode-plugin-inject'; import React, { createElement } from 'react'; @@ -138,7 +145,7 @@ export async function parseAssets(assets: AssetsJson) { const libraryAsset = []; const libraryMap = {}; const packagesMap = {}; - packages.forEach(pkg => { + packages.forEach((pkg) => { const { package: _package, library, urls, renderUrls, id } = pkg; if (_package) { libraryMap[id || _package] = library; @@ -173,38 +180,48 @@ export async function parseAssets(assets: AssetsJson) { await Promise.all( remoteComponentDescriptions.map(async (component: any) => { const { exportName, url, npm } = component; - await (new AssetLoader()).load(url); + await new AssetLoader().load(url); function setAssetsComponent(component: any, extraNpmInfo: any = {}) { const components = component.components; if (Array.isArray(components)) { - components.forEach(d => { - newComponents = newComponents.concat({ - npm: { - ...npm, - ...extraNpmInfo, - }, - ...d, - } || []); + components.forEach((d) => { + newComponents = newComponents.concat( + { + npm: { + ...npm, + ...extraNpmInfo, + }, + ...d, + } || [], + ); }); return; } - newComponents = newComponents.concat({ - npm: { - ...npm, - ...extraNpmInfo, - }, - ...component.components, - } || []); + newComponents = newComponents.concat( + { + npm: { + ...npm, + ...extraNpmInfo, + }, + ...component.components, + } || [], + ); } - function setArrayAssets(value: any[], preExportName: string = '', preSubName: string = '') { + function setArrayAssets( + value: any[], + preExportName: string = '', + preSubName: string = '', + ) { value.forEach((d: any, i: number) => { - const exportName = [preExportName, i.toString()].filter(d => !!d).join('.'); - const subName = [preSubName, i.toString()].filter(d => !!d).join('.'); - Array.isArray(d) ? setArrayAssets(d, exportName, subName) : setAssetsComponent(d, { - exportName, - subName, - }); + const exportName = [preExportName, i.toString()].filter((d) => !!d).join('.'); + const subName = [preSubName, i.toString()].filter((d) => !!d).join('.'); + Array.isArray(d) + ? setArrayAssets(d, exportName, subName) + : setAssetsComponent(d, { + exportName, + subName, + }); }); } if (window[exportName]) { @@ -230,14 +247,14 @@ export async function parseAssets(assets: AssetsJson) { }; } return acc; - }, {}) + }, {}); function genLowCodeComponentsMap(components) { const lowcodeComponentsMap = {}; lowcodeComponentsArray.forEach((lowcode) => { const id = lowcode.reference?.id; const schema = packagesMap[id]?.schema; - const comp = genLowcodeComp(schema, {...components, ...lowcodeComponentsMap}); + const comp = genLowcodeComp(schema, { ...components, ...lowcodeComponentsMap }); lowcodeComponentsMap[lowcode.componentName] = comp; }); return lowcodeComponentsMap; @@ -245,8 +262,8 @@ export async function parseAssets(assets: AssetsJson) { let components = await injectComponents(buildComponents(libraryMap, proCodeComponentsMap)); const lowCodeComponents = genLowCodeComponentsMap(components); return { - components: { ...components, ...lowCodeComponents } - } + components: { ...components, ...lowCodeComponents }, + }; } function genLowcodeComp(schema: ComponentSchema, components: any) { @@ -262,6 +279,7 @@ function genLowcodeComp(schema: ComponentSchema, components: any) { }; } ``` + ## 联系我们 - \ No newline at end of file + diff --git a/docs/docs/guide/expand/editor/pluginContextMenu.md b/docs/docs/guide/expand/editor/pluginContextMenu.md index 962c913e7e..853a8639ac 100644 --- a/docs/docs/guide/expand/editor/pluginContextMenu.md +++ b/docs/docs/guide/expand/editor/pluginContextMenu.md @@ -6,13 +6,14 @@ sidebar_position: 6 ## 场景一:扩展选中节点操作项 ### 增加节点操作项 + ![image.png](https://img.alicdn.com/imgextra/i2/O1CN01J7PrJc1S86XNDBIFQ_!!6000000002201-2-tps-1240-292.png) 选中节点后,在选中框的右上角有操作按钮,编排模块默认实现了查看组件直系父节点、复制节点和删除节点按钮外,还可以通过相关 API 来扩展更多操作,如下代码: ```typescript -import { plugins } from '@alilc/lowcode-engine'; -import { IPublicModelPluginContext, IPublicModelNode } from '@alilc/lowcode-types'; +import { plugins } from '@felce/lowcode-engine'; +import { IPublicModelPluginContext, IPublicModelNode } from '@felce/lowcode-types'; import { Icon, Message } from '@alifd/next'; const addHelloAction = (ctx: IPublicModelPluginContext) => { @@ -44,18 +45,19 @@ await plugins.register(addHelloAction); ![image.png](https://img.alicdn.com/imgextra/i2/O1CN01O8W2H61ybw2b7K5nV_!!6000000006598-2-tps-1315-343.png) 具体 API 参考:[API 文档](/site/docs/api/material#addbuiltincomponentaction) + ### 删除节点操作项 ```typescript -import { plugins } from '@alilc/lowcode-engine'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { plugins } from '@felce/lowcode-engine'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; const removeCopyAction = (ctx: IPublicModelPluginContext) => { return { async init() { ctx.material.removeBuiltinComponentAction('copy'); - } - } + }, + }; }; removeCopyAction.pluginName = 'removeCopyAction'; await plugins.register(removeCopyAction); @@ -71,12 +73,12 @@ await plugins.register(removeCopyAction); ### 区块管理 -- 仓库地址:[https://github.com/alibaba/lowcode-plugins](https://github.com/alibaba/lowcode-plugins) -- 具体代码:[https://github.com/alibaba/lowcode-plugins/tree/main/packages/action-block](https://github.com/alibaba/lowcode-plugins/tree/main/packages/action-block) +- 仓库地址:[https://github.com/fe-lce/lowcode-plugins](https://github.com/fe-lce/lowcode-plugins) +- 具体代码:[https://github.com/fe-lce/lowcode-plugins/tree/main/packages/action-block](https://github.com/fe-lce/lowcode-plugins/tree/main/packages/action-block) - 直播回放: - - [低代码引擎项目实战 (9)-区块管理 (1)-保存为区块](https://www.bilibili.com/video/BV1YF411M7RK/) - - [低代码引擎项目实战 (10)-区块管理 - 区块面板](https://www.bilibili.com/video/BV1FB4y1S7tu/) - - [阿里巴巴低代码引擎项目实战 (11)-区块管理 - ICON 优化](https://www.bilibili.com/video/BV1zr4y1H7Km/) - - [阿里巴巴低代码引擎项目实战 (11)-区块管理 - 自动截图](https://www.bilibili.com/video/BV1GZ4y117VH/) - - [阿里巴巴低代码引擎项目实战 (11)-区块管理 - 样式优化](https://www.bilibili.com/video/BV1Pi4y1S7ZT/) - - [阿里低代码引擎项目实战 (12)-区块管理 (完结)-给引擎插件提个 PR](https://www.bilibili.com/video/BV1hB4y1277o/) + - [低代码引擎项目实战 (9)-区块管理 (1)-保存为区块](https://www.bilibili.com/video/BV1YF411M7RK/) + - [低代码引擎项目实战 (10)-区块管理 - 区块面板](https://www.bilibili.com/video/BV1FB4y1S7tu/) + - [阿里巴巴低代码引擎项目实战 (11)-区块管理 - ICON 优化](https://www.bilibili.com/video/BV1zr4y1H7Km/) + - [阿里巴巴低代码引擎项目实战 (11)-区块管理 - 自动截图](https://www.bilibili.com/video/BV1GZ4y117VH/) + - [阿里巴巴低代码引擎项目实战 (11)-区块管理 - 样式优化](https://www.bilibili.com/video/BV1Pi4y1S7ZT/) + - [阿里低代码引擎项目实战 (12)-区块管理 (完结)-给引擎插件提个 PR](https://www.bilibili.com/video/BV1hB4y1277o/) diff --git a/docs/docs/guide/expand/editor/pluginWidget.md b/docs/docs/guide/expand/editor/pluginWidget.md index 06125575f6..126f811630 100644 --- a/docs/docs/guide/expand/editor/pluginWidget.md +++ b/docs/docs/guide/expand/editor/pluginWidget.md @@ -18,11 +18,11 @@ sidebar_position: 5 ## 注册插件 API ```typescript -import { plugins } from '@alilc/lowcode-engine'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { plugins } from '@felce/lowcode-engine'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; const pluginA = (ctx: IPublicModelPluginContext, options: any) => { - return { + return { init() { console.log(options.key); // 往引擎增加面板 @@ -109,7 +109,7 @@ PanelDock 是以面板的形式展示在设计器的左侧区域的。其中主 接入可以参考代码 ```javascript -import { skeleton } from '@alilc/lowcode-engine'; +import { skeleton } from '@felce/lowcode-engine'; skeleton.add({ area: 'leftArea', // 插件区域 @@ -117,9 +117,9 @@ skeleton.add({ name: 'sourceEditor', content: SourceEditor, // 插件组件实例 props: { - align: "left", - icon: "wenjian", - description: "JS 面板", + align: 'left', + icon: 'wenjian', + description: 'JS 面板', }, panelProps: { floatable: true, // 是否可浮动 @@ -127,7 +127,7 @@ skeleton.add({ hideTitleBar: false, maxHeight: 800, maxWidth: 1200, - title: "JS 面板", + title: 'JS 面板', width: 600, }, }); @@ -142,17 +142,17 @@ Widget 形式是直接渲染在当前编辑器的对应位置上。如 demo 中 接入可以参考代码: ```javascript -import { skeleton } from '@alilc/lowcode-engine'; +import { skeleton } from '@felce/lowcode-engine'; // 注册 logo 面板 skeleton.add({ area: 'topArea', type: 'Widget', name: 'logo', content: Logo, // Widget 组件实例 - contentProps: { // Widget 插件 props - logo: - "https://img.alicdn.com/tfs/TB1_SocGkT2gK0jSZFkXXcIQFXa-66-66.png", - href: "/", + contentProps: { + // Widget 插件 props + logo: 'https://img.alicdn.com/tfs/TB1_SocGkT2gK0jSZFkXXcIQFXa-66-66.png', + href: '/', }, props: { align: 'left', @@ -166,7 +166,7 @@ skeleton.add({ 一个图标的表现形式,可以用于语言切换、跳转到外部链接、打开一个 widget 等场景。 ```javascript -import { skeleton } from '@alilc/lowcode-engine'; +import { skeleton } from '@felce/lowcode-engine'; skeleton.add({ area: 'leftArea', @@ -180,8 +180,8 @@ skeleton.add({ window.open('https://lowcode-engine.cn'); // 显示 widget skeleton.showWidget('xxx'); - } - } + }, + }, }); ``` @@ -196,19 +196,19 @@ skeleton.add({ - 仓库地址:[https://github.com/mark-ck/lowcode-portal](https://github.com/mark-ck/lowcode-portal) - 具体代码:[https://github.com/mark-ck/lowcode-portal/blob/master/src/plugins/pages-plugin/index.tsx](https://github.com/mark-ck/lowcode-portal/blob/master/src/plugins/pages-plugin/index.tsx) - 直播回放: - - [低代码引擎项目实战 (4)-自定义插件 - 页面管理](https://www.bilibili.com/video/BV17a411i73f/) - - [低代码引擎项目实战 (4)-自定义插件 - 页面管理 - 后端](https://www.bilibili.com/video/BV1uZ4y1U7Ly/) - - [低代码引擎项目实战 (4)-自定义插件 - 页面管理 - 前端](https://www.bilibili.com/video/BV1Yq4y1a74P/) - - [低代码引擎项目实战 (4)-自定义插件 - 页面管理 - 完结](https://www.bilibili.com/video/BV13Y4y1e7EV/) + - [低代码引擎项目实战 (4)-自定义插件 - 页面管理](https://www.bilibili.com/video/BV17a411i73f/) + - [低代码引擎项目实战 (4)-自定义插件 - 页面管理 - 后端](https://www.bilibili.com/video/BV1uZ4y1U7Ly/) + - [低代码引擎项目实战 (4)-自定义插件 - 页面管理 - 前端](https://www.bilibili.com/video/BV1Yq4y1a74P/) + - [低代码引擎项目实战 (4)-自定义插件 - 页面管理 - 完结](https://www.bilibili.com/video/BV13Y4y1e7EV/) ### 区块面板 -- 仓库地址:[https://github.com/alibaba/lowcode-plugins](https://github.com/alibaba/lowcode-plugins) -- 具体代码:[https://github.com/alibaba/lowcode-plugins/tree/main/packages/plugin-block](https://github.com/alibaba/lowcode-plugins/tree/main/packages/plugin-block) +- 仓库地址:[https://github.com/fe-lce/lowcode-plugins](https://github.com/fe-lce/lowcode-plugins) +- 具体代码:[https://github.com/fe-lce/lowcode-plugins/tree/main/packages/plugin-block](https://github.com/fe-lce/lowcode-plugins/tree/main/packages/plugin-block) - 直播回放: - - [低代码引擎项目实战 (9)-区块管理 (1)-保存为区块](https://www.bilibili.com/video/BV1YF411M7RK/) - - [低代码引擎项目实战 (10)-区块管理 - 区块面板](https://www.bilibili.com/video/BV1FB4y1S7tu/) - - [阿里巴巴低代码引擎项目实战 (11)-区块管理 - ICON 优化](https://www.bilibili.com/video/BV1zr4y1H7Km/) - - [阿里巴巴低代码引擎项目实战 (11)-区块管理 - 自动截图](https://www.bilibili.com/video/BV1GZ4y117VH/) - - [阿里巴巴低代码引擎项目实战 (11)-区块管理 - 样式优化](https://www.bilibili.com/video/BV1Pi4y1S7ZT/) - - [阿里低代码引擎项目实战 (12)-区块管理 (完结)-给引擎插件提个 PR](https://www.bilibili.com/video/BV1hB4y1277o/) + - [低代码引擎项目实战 (9)-区块管理 (1)-保存为区块](https://www.bilibili.com/video/BV1YF411M7RK/) + - [低代码引擎项目实战 (10)-区块管理 - 区块面板](https://www.bilibili.com/video/BV1FB4y1S7tu/) + - [阿里巴巴低代码引擎项目实战 (11)-区块管理 - ICON 优化](https://www.bilibili.com/video/BV1zr4y1H7Km/) + - [阿里巴巴低代码引擎项目实战 (11)-区块管理 - 自动截图](https://www.bilibili.com/video/BV1GZ4y117VH/) + - [阿里巴巴低代码引擎项目实战 (11)-区块管理 - 样式优化](https://www.bilibili.com/video/BV1Pi4y1S7ZT/) + - [阿里低代码引擎项目实战 (12)-区块管理 (完结)-给引擎插件提个 PR](https://www.bilibili.com/video/BV1hB4y1277o/) diff --git a/docs/docs/guide/expand/editor/setter.md b/docs/docs/guide/expand/editor/setter.md index 4f0e0219fc..16dde0fd9c 100644 --- a/docs/docs/guide/expand/editor/setter.md +++ b/docs/docs/guide/expand/editor/setter.md @@ -2,6 +2,7 @@ title: 设置器扩展 sidebar_position: 7 --- + ## 设置器简述 设置器主要用于低代码组件属性值的设置,顾名思义叫"设置器",又称为 Setter。由于组件的属性有各种类型,需要有与之对应的设置器支持,每一个设置器对应一个值的类型。 @@ -101,6 +102,7 @@ props 字段是入料模块扫描自动填入的类型,用户可以通过 conf ``` ## 自定义设置器 + ### 编写 AltStringSetter 我们编写一个简单的 Setter,它的功能如下: @@ -108,10 +110,11 @@ props 字段是入料模块扫描自动填入的类型,用户可以通过 conf ![image.png](https://img.alicdn.com/imgextra/i3/O1CN01fQ4GLd1RzrPSdULiw_!!6000000002183-2-tps-720-90.png) **代码如下:** + ```tsx -import * as React from "react"; -import { Input } from "@alifd/next"; -import "./index.scss"; +import * as React from 'react'; +import { Input } from '@alifd/next'; +import './index.scss'; interface AltStringSetterProps { // 当前值 @@ -126,7 +129,7 @@ interface AltStringSetterProps { export default class AltStringSetter extends React.PureComponent { // 声明 Setter 的 title - static displayName = 'AltStringSetter'; + static displayName = 'AltStringSetter'; componentDidMount() { const { onChange, value, defaultValue } = this.props; @@ -140,7 +143,7 @@ export default class AltStringSetter extends React.PureComponent onChange(val)} > ); @@ -153,7 +156,7 @@ export default class AltStringSetter extends React.PureComponent { const { field, value } = this.props; // 这里展示的和插件进行通信,事件规则是插件名 + 方法 event.emit('eventBindDialog.openDialog', field.name, this.emitEventName); -} +}; ``` #### 修改同级 props 的其他属性值 @@ -189,13 +192,13 @@ setter 本身只影响其中一个 props 的值,如果需要影响其他组件 ```javascript bindFunction = () => { - const { field, value } = this.props; - const propsField = field.parent; - // 获取同级其他属性 showJump 的值 - const otherValue = propsField.getPropValue('showJump'); - // set 同级其他属性 showJump 的值 - propsField.setPropValue('showJump', false); -} + const { field, value } = this.props; + const propsField = field.parent; + // 获取同级其他属性 showJump 的值 + const otherValue = propsField.getPropValue('showJump'); + // set 同级其他属性 showJump 的值 + propsField.setPropValue('showJump', false); +}; ``` ### 注册 AltStringSetter @@ -238,4 +241,4 @@ registerSetter('AltStringSetter', AltStringSetter); ] } } -``` \ No newline at end of file +``` diff --git a/docs/docs/guide/expand/editor/summary.md b/docs/docs/guide/expand/editor/summary.md index 814340f3d3..96b264d0e8 100644 --- a/docs/docs/guide/expand/editor/summary.md +++ b/docs/docs/guide/expand/editor/summary.md @@ -2,6 +2,7 @@ title: 编辑态扩展简述 sidebar_position: 0 --- + ## 扩展点简述 我们可以从 Demo 的项目中看到页面中有很多的区块: @@ -22,9 +23,11 @@ sidebar_position: 0 ## 配置扩展点 ### 配置物料 + 通过配置注入物料,这里的配置是物料中心根据物料资产包协议生成的,后面“物料扩展”章节会有详细说明。 + ```typescript -import { material } from '@alilc/lowcode-engine'; +import { material } from '@felce/lowcode-engine'; // 假设您已把物料配置在本地 import assets from './assets.json'; @@ -33,45 +36,54 @@ material.setAssets(assets); ``` 也可以通过异步加载物料中心上的物料。 + ```typescript -import { material, plugins } from '@alilc/lowcode-engine'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { material, plugins } from '@felce/lowcode-engine'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; // 动态加载 assets -plugins.register((ctx: IPublicModelPluginContext) => { - return { - name: 'ext-assets', - async init() { - try { - // 将下述链接替换为您的物料即可。无论是通过 utils 从物料中心引入,还是通过其他途径如直接引入物料描述 - const res = await window.fetch('https://fusion.alicdn.com/assets/default@0.1.95/assets.json') - const assets = await res.text() - material.setAssets(assets) - } catch (err) { - console.error(err) - } - }, - } -}).catch(err => console.error(err)); +plugins + .register((ctx: IPublicModelPluginContext) => { + return { + name: 'ext-assets', + async init() { + try { + // 将下述链接替换为您的物料即可。无论是通过 utils 从物料中心引入,还是通过其他途径如直接引入物料描述 + const res = await window.fetch( + 'https://fusion.alicdn.com/assets/default@0.1.95/assets.json', + ); + const assets = await res.text(); + material.setAssets(assets); + } catch (err) { + console.error(err); + } + }, + }; + }) + .catch((err) => console.error(err)); ``` ### 配置插件 + 可以通过 npm 包的方式引入社区插件,配置如下所示: + ```typescript -import { plugins } from '@alilc/lowcode-engine'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { plugins } from '@felce/lowcode-engine'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; import PluginIssueTracker from '@alilc/lowcode-plugin-issue-tracker'; // 注册一个提 issue 组件到您的编辑器中,方位默认在左栏下侧 -plugins.register(PluginIssueTracker) - .catch(err => console.error(err)); +plugins.register(PluginIssueTracker).catch((err) => console.error(err)); ``` + 后续“插件扩展”章节会详细说明。 ### 配置设置器 + 低代码引擎默认内置了设置器(详见“配置设置器”章节)。您可以通过 npm 包的方式引入自定义的设置器,配置如下所示: + ```typescript -import { setters } from '@alilc/lowcode-engine'; +import { setters } from '@felce/lowcode-engine'; // 假设您自定义了一个 setter import MuxMonacoEditorSetter from './components/setters/MuxMonacoEditorSetter'; @@ -81,12 +93,13 @@ setters.registerSetter({ component: MuxMonacoEditorSetter, title: 'Textarea', condition: (field) => { - const v = field.getValue() - return typeof v === 'string' + const v = field.getValue(); + return typeof v === 'string'; }, }, }); ``` + 后续“设置器扩展”章节会详细说明。 -> 本章节所有可扩展配置内容在 demo 中均可找到:[https://github.com/alibaba/lowcode-demo/tree/main/demo-general](https://github.com/alibaba/lowcode-demo/tree/main/demo-general) +> 本章节所有可扩展配置内容在 demo 中均可找到:[https://github.com/fe-lce/lowcode-demo/tree/main/demo-general](https://github.com/fe-lce/lowcode-demo/tree/main/demo-general) diff --git a/docs/docs/guide/expand/runtime/codeGeneration.md b/docs/docs/guide/expand/runtime/codeGeneration.md index 71cf81bd1c..1fbced4b82 100644 --- a/docs/docs/guide/expand/runtime/codeGeneration.md +++ b/docs/docs/guide/expand/runtime/codeGeneration.md @@ -4,28 +4,35 @@ sidebar_position: 1 --- ## 出码简述 + 所谓出码,即将低代码编排出的 schema 进行解析并转换成最终可执行的代码的过程。 + ## 出码的适用范围 + 出码是为了更高效的运行和更灵活地定制渲染,相对而言,基于 Schema 的运行时渲染,有着能实时响应内容的变化和接入成本低的优点,但是也存在着实时解析运行的性能开销比较大和包大小比较大的问题,而且无法自由地进行扩展二次开发,功能自由度受到一定程度限制。 当然,出码也会存在一些限制:一方面需要额外的接入成本,另一方面通常需要额外的生成代码和打包构建的时间,难以做到基于 Schema 的运行时渲染那样保存即预览的效果。 所以不是所有场景都建议做出码,一般来说以下 3 个场景可以考虑使用出码进行优化。 ### 场景一:想要极致的打开速度,降低 LCP/FID + 这种场景比较常见的是 C 端应用,比如手淘上的页面和手机钉钉上的页面,要求能够尽快得响应用户操作,不要出现卡死的情况。当一个流入协议大小比较大的时候,前端进行解析时的开销也比较大。如果能把这部分负担转移到编译时去完成的话,前端依赖包大小就会减少许多。从而也提升了加载速度,降低了带宽消耗。页面越简单,这其中的 gap 就会越明显。 ### 场景二:老项目 + 新需求,想用搭建产出 + 这是一个很常见的场景,毕竟迁移或者重构都是有一个过程的,阿里的业务都是一边跑一边换发动机。在这种场景中,我们不可能要求使用运行时方案来做实现,因为运行时是一个项目级别的能力,最好是项目中统一使用他这一种方式,保证体验的一致性与连贯性。所以我们可以只在低代码平台上搭建新的业务页面,然后通过出码模块导出这些页面的源码,连同一些全局依赖模块,一起 Merge 到老项目中。完成开发体验的优化。 ### 场景三:协议不能描述部分代码逻辑(协议功能不足或特别定制化的逻辑) + 当我们发现一些逻辑诉求不能在目前协议中很好地表达的时候,这其实是项目复杂度较高的一个信号。比较好的方式就是将低代码研发和源码研发结合起来。这种模式下最大的诉求点之一就是,需要将搭建的内容输出为可读性和确定性都比较良好的代码模块。这也就是出码模块需要支持好的使用场景了。 ## 如何使用 + ### 1) 通过命令行快速体验 -欢迎使用命令行工具快速体验:`npx @alilc/lowcode-code-generator -i example-schema.json -o generated -s icejs3` +欢迎使用命令行工具快速体验:`npx @felce/lowcode-code-generator -i example-schema.json -o generated -s icejs3` ---其中 example-schema.json 可以从[这里下载](https://alifd.alicdn.com/npm/@alilc/lowcode-code-generator@latest/example-schema.json) +--其中 example-schema.json 可以从[这里下载](https://alifd.alicdn.com/npm/@felce/lowcode-code-generator@latest/example-schema.json) ### 2) 通过设计器插件快速体验 @@ -33,7 +40,7 @@ sidebar_position: 1 2. 注册插件: ```typescript -import { plugins } from '@alilc/lowcode-engine'; +import { plugins } from '@felce/lowcode-engine'; import CodeGenPlugin from '@alilc/lowcode-plugin-code-generator'; // 在你的初始化函数中: @@ -49,11 +56,11 @@ await plugins.register(CodeGenPlugin, { disableCodeGenActionBtn: true }); 此代码生成器一开始就是为服务端出码设计的,你可以直接这样来在 node.js 环境中使用: -1. 安装依赖: `npm install --save @alilc/lowcode-code-generator` +1. 安装依赖: `npm install --save @felce/lowcode-code-generator` 2. 引入代码生成器: ```javascript -import CodeGenerator from '@alilc/lowcode-code-generator'; +import CodeGenerator from '@felce/lowcode-code-generator'; ``` 3. 创建项目构建器: @@ -94,11 +101,11 @@ await CodeGenerator.publishers.zip().publish({ 随着现在电脑性能和浏览器技术的发展,出码其实已经不必非得在服务端做了,借助于 Web Worker 特性,可以在浏览器中进行出码: -1. 安装依赖: `npm install --save @alilc/lowcode-code-generator` +1. 安装依赖: `npm install --save @felce/lowcode-code-generator` 2. 引入代码生成器: ```javascript -import * as CodeGenerator from '@alilc/lowcode-code-generator/standalone-loader'; +import * as CodeGenerator from '@felce/lowcode-code-generator/standalone-loader'; ``` 3. 【可选】提前初始化代码生成器: @@ -122,12 +129,15 @@ console.log(result); // 出码结果 (默认是递归结构描述的,可以传 注:一般来说在浏览器中出码适合做即时预览功能。 ### 5)自定义出码 + 前端框架灵活多变,默认内置的出码方案很难满足所有人的需求,好在此代码生成器支持非常灵活的插件机制 -- 内置功能大多都是通过插件完成的(在 `src/plugins`下),比如: ![image.png](https://img.alicdn.com/imgextra/i1/O1CN01CEl2Hq1omnH0UCyGF_!!6000000005268-2-tps-457-376.png) 所以您可以通过添加自己的插件或替换掉默认内置的插件来实现您的自定义功能。 为了方便自定义出码方案,出码模块还提供自定义出码方案的脚手架功能,即执行下面脚本即可生成一个自定义出码方案: + ```shell -npx @alilc/lowcode-code-generator init-solution +npx @felce/lowcode-code-generator init-solution ``` + 里面内置了一个示例的插件 (在 `src/plugins/example.ts`中),您可以根据注释引导来完善相关插件,从而组合生成您的专属出码方案 (`src/index.ts`)。您所生成的出码方案可以发布成 NPM 包,从而能按上文 1~4 中的使用方案进行使用。 diff --git a/docs/docs/guide/expand/runtime/renderer.md b/docs/docs/guide/expand/runtime/renderer.md index 4e6d914bbf..9874c97e5b 100644 --- a/docs/docs/guide/expand/runtime/renderer.md +++ b/docs/docs/guide/expand/runtime/renderer.md @@ -2,12 +2,15 @@ title: 使用渲染模块 sidebar_position: 0 --- + ## 快速使用 + 渲染依赖于 schema 和 components。其中 schema 和 components 需要一一对应,schema 中使用到的组件都需要在 components 中进行声明,否则无法正常渲染。 + ### 简单示例 ```jsx -import ReactRenderer from '@alilc/lowcode-react-renderer'; +import ReactRenderer from '@felce/lowcode-react-renderer'; import ReactDOM from 'react-dom'; import { Button } from '@alifd/next'; @@ -20,7 +23,7 @@ const schema = { props: { type: 'primary', style: { - color: '#2077ff' + color: '#2077ff', }, }, children: '确定', @@ -32,58 +35,59 @@ const components = { Button, }; -ReactDOM.render(( - -), document.getElementById('root')); +ReactDOM.render( + , + document.getElementById('root'), +); ``` #### + ### 项目使用示例 + > [设计器 demo](https://lowcode-engine.cn/demo/demo-general/index.html) -> 项目代码完整示例:[https://github.com/alibaba/lowcode-demo](https://github.com/alibaba/lowcode-demo) +> 项目代码完整示例:[https://github.com/fe-lce/lowcode-demo](https://github.com/fe-lce/lowcode-demo) **step 1:在设计器中获取组件列表** + ```typescript -import { material, project } from '@alilc/lowcode-engine'; -const packages = material.getAssets().packages +import { material, project } from '@felce/lowcode-engine'; +const packages = material.getAssets().packages; ``` + **step 2:在设计器中获取当前配置页面的 schema** + ```typescript -import { material, project } from '@alilc/lowcode-engine'; +import { material, project } from '@felce/lowcode-engine'; const schema = project.exportSchema(); ``` - **step 3:以某种方式存储 schema 和 packages** 这里用 localStorage 作为存储示例,真实项目中使用数据库或者其他存储方式。 + ```typescript -window.localStorage.setItem( - 'projectSchema', - JSON.stringify(project.exportSchema()) -); +window.localStorage.setItem('projectSchema', JSON.stringify(project.exportSchema())); const packages = await filterPackages(material.getAssets().packages); -window.localStorage.setItem( - 'packages', - JSON.stringify(packages) -); +window.localStorage.setItem('packages', JSON.stringify(packages)); ``` + **step 4:预览时,获取存储的 schema 和 packages** + ```typescript const packages = JSON.parse(window.localStorage.getItem('packages') || ''); const projectSchema = JSON.parse(window.localStorage.getItem('projectSchema') || ''); const { componentsMap: componentsMapArray, componentsTree } = projectSchema; ``` + **step 5:通过整合 schema 和 packages 信息,进行渲染** + ```typescript import ReactDOM from 'react-dom'; import React, { useState } from 'react'; import { Loading } from '@alifd/next'; -import { buildComponents, assetBundle, AssetLevel, AssetLoader } from '@alilc/lowcode-utils'; -import ReactRenderer from '@alilc/lowcode-react-renderer'; +import { buildComponents, assetBundle, AssetLevel, AssetLoader } from '@felce/lowcode-utils'; +import ReactRenderer from '@felce/lowcode-react-renderer'; import { injectComponents } from '@alilc/lowcode-plugin-inject'; const SamplePreview = () => { @@ -142,9 +146,10 @@ const SamplePreview = () => { }; ReactDOM.render(, document.getElementById('ice-container')); - ``` + ### 国际化示例 + ```typescript class Demo extends PureComponent { static displayName = 'renderer-demo'; @@ -157,12 +162,12 @@ class Demo extends PureComponent { components={components} appHelper={{ utils, - constants + constants, }} locale="zh-CN" messages={{ - "hello": "你好", - "china": "中国" + hello: '你好', + china: '中国', }} /> @@ -173,32 +178,33 @@ class Demo extends PureComponent { ## API -| 参数 | 说明 | 类型 | 必选 | -| --- | --- | --- | --- | -| schema | 符合[搭建协议](https://lowcode-engine.cn/lowcode)的数据 | Object | 是 | -| components | 组件依赖的实例 | Object | 是 | -| componentsMap | 组件的配置信息 | Object | 否 | -| appHelper | 渲染模块全局上下文 | Object | 否 | -| designMode | 设计模式,可选值:extend、border、preview | String | 否 | -| suspended | 是否挂起 | Boolean | 否 | -| onCompGetRef | 组件 ref 回调(schema, ref)=> {} | Function | 否 | -| onCompGetCtx | 组件 ctx 更新回调 (schema, ctx) => {} | Function | 否 | -| rendererName | 渲染类型,标识当前模块是以什么类型进行渲染的 | string | 否 | -| customCreateElement | 自定义创建 element 的钩子 -(Component, props, children) => {} | Function | 否 | -| notFoundComponent | 当组件找不到时,可以通过这个参数自定义展示文案。 | Component | 否 | -| thisRequiredInJSE | 为 true 的情况下 JSExpression 仅支持通过 this 来访问。假如需要兼容原来的 'state.xxx',则设置为 false,推荐使用 true。 | Boolean | 否 | -| locale | 国际化语言类型 | string | 否 | -| messages | 国际化语言对象 | Object | 否 | - +| 参数 | 说明 | 类型 | 必选 | +| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------- | ---- | +| schema | 符合[搭建协议](https://lowcode-engine.cn/lowcode)的数据 | Object | 是 | +| components | 组件依赖的实例 | Object | 是 | +| componentsMap | 组件的配置信息 | Object | 否 | +| appHelper | 渲染模块全局上下文 | Object | 否 | +| designMode | 设计模式,可选值:extend、border、preview | String | 否 | +| suspended | 是否挂起 | Boolean | 否 | +| onCompGetRef | 组件 ref 回调(schema, ref)=> {} | Function | 否 | +| onCompGetCtx | 组件 ctx 更新回调 (schema, ctx) => {} | Function | 否 | +| rendererName | 渲染类型,标识当前模块是以什么类型进行渲染的 | string | 否 | +| customCreateElement | 自定义创建 element 的钩子 | +| (Component, props, children) => {} | Function | 否 | +| notFoundComponent | 当组件找不到时,可以通过这个参数自定义展示文案。 | Component | 否 | +| thisRequiredInJSE | 为 true 的情况下 JSExpression 仅支持通过 this 来访问。假如需要兼容原来的 'state.xxx',则设置为 false,推荐使用 true。 | Boolean | 否 | +| locale | 国际化语言类型 | string | 否 | +| messages | 国际化语言对象 | Object | 否 | ### schema 搭建基础协议数据,渲染模块将基于 schema 中的内容进行实时渲染。 ### messages + 国际化内容,需要配合 locale 使用 messages 格式示例: + ```typescript { 'zh-CN': { @@ -211,6 +217,7 @@ messages 格式示例: ``` ### locale + 当前语言类型 示例:'zh-CN' | 'en-US' @@ -222,7 +229,6 @@ messages 格式示例: > 在生产环境下不需要设置。 - 配置规范参见[《低代码引擎搭建协议规范》](https://lowcode-engine.cn/lowcode),主要在搭建场景中使用,用于提升用户搭建体验。 - 属性配置校验:用户可以配置组件特定属性的 `propTypes`,在搭建场景中用户输入的属性值不满足 `propType` 配置时,渲染模块会将当前属性设置为 `undefined`,避免组件抛错导致编辑器崩溃; @@ -243,65 +249,71 @@ appHelper 主要用于设置渲染模块的全局上下文,目前 appHelper ```javascript export default { - "componentName": "Page", - "fileName": "test", - "props": {}, - "children": [{ - "componentName": "Div", - "props": {}, - "children": [{ - "componentName": "Text", - "props": { - "text": { - "type": "JSExpression", - "value": "this.location.pathname" - } - } - }, { - "componentName": "Button", - "props": { - "type": "primary", - "style": { - "marginLeft": 10 + componentName: 'Page', + fileName: 'test', + props: {}, + children: [ + { + componentName: 'Div', + props: {}, + children: [ + { + componentName: 'Text', + props: { + text: { + type: 'JSExpression', + value: 'this.location.pathname', + }, + }, }, - "onClick": { - "type": "JSExpression", - "value": "function onClick(e) { this.utils.xxx(this.constants.yyy);}" - } - }, - "children": "click me" - }] - }] -} + { + componentName: 'Button', + props: { + type: 'primary', + style: { + marginLeft: 10, + }, + onClick: { + type: 'JSExpression', + value: 'function onClick(e) { this.utils.xxx(this.constants.yyy);}', + }, + }, + children: 'click me', + }, + ], + }, + ], +}; ``` ```typescript -import ReactRenderer from '@alilc/lowcode-react-renderer'; +import ReactRenderer from '@felce/lowcode-react-renderer'; import ReactDOM from 'react-dom'; import { Button } from '@alifd/next'; -import schema from './schema' +import schema from './schema'; const components = { Button, }; -ReactDOM.render(( +ReactDOM.render( {} - } + appHelper={{ + utils: { + xxx: () => {}, + }, }} - /> -), document.getElementById('root')); + />, + document.getElementById('root'), +); ``` + ### designMode > 在生产环境下不需要设置。 - designMode 属性主要在搭建场景中使用,主要有以下作用: - 当 `designMode` 改变时,触发当前 schema 中所有组件重新渲染 @@ -319,22 +331,25 @@ designMode 属性主要在搭建场景中使用,主要有以下作用: - `ref`:当前组件的 ref 实例 ### onCompGetCtx + 组件 ctx 更新的回调,在组件每次 render 渲染周期我们都会为组件构造新的上下文环境,因此该回调函数会在组件每次 render 过程中触发,主要包含两个参数: - `schema`:当前组件的 schema 模型结构 - `ctx`:当前组件的上下文信息,主要包含以下内容: - - `page`:当前页面容器实例 - - `this`: 当前组件所属的容器组件实例 - - `item`/`index`: 循环上下文(属性 key 可以根据 loopArgs 进行定制) - - `form`: 表单上下文 + - `page`:当前页面容器实例 + - `this`: 当前组件所属的容器组件实例 + - `item`/`index`: 循环上下文(属性 key 可以根据 loopArgs 进行定制) + - `form`: 表单上下文 ### rendererName + 渲染类型,标识当前模块是以什么类型进行渲染的 - `LowCodeRenderer`: 低代码组件 - `PageRenderer`: 页面 ### customCreateElement + 自定义创建 element 的钩子,用于在渲染前后对组件进行一些处理,包括但不限于增加 props、删除部分 props。主要包含三个参数: - `Component`:要渲染的组件 @@ -342,6 +357,7 @@ designMode 属性主要在搭建场景中使用,主要有以下作用: - `children`:要渲染的组件的子元素 ### thisRequiredInJSE + > 版本 >= 1.0.11 默认值:true diff --git a/docs/docs/guide/quickStart/start.md b/docs/docs/guide/quickStart/start.md index 356f501769..e37d754fce 100644 --- a/docs/docs/guide/quickStart/start.md +++ b/docs/docs/guide/quickStart/start.md @@ -45,7 +45,7 @@ n 14.17.0 ### 下载 Demo -可以前往 github()将 DEMO 下载到本地。 +可以前往 github()将 DEMO 下载到本地。 #### git clone @@ -54,7 +54,7 @@ n 14.17.0 需要使用到 git 工具 ```bash -git clone https://github.com/alibaba/lowcode-demo.git +git clone https://github.com/fe-lce/lowcode-demo.git ``` ##### SSH @@ -62,7 +62,7 @@ git clone https://github.com/alibaba/lowcode-demo.git 需要配置 SSH key,如果没有配置可以 ```bash -git clone git@github.com:alibaba/lowcode-demo.git +git clone git@github.com:fe-lce/lowcode-demo.git ``` #### 下载 Zip 包 @@ -157,7 +157,7 @@ Demo 根据**不同的设计器所需要的物料不同**,分为了下面的 8 ```javascript import * as React from 'react'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; const LowcodePluginPluginDemo = (ctx: IPublicModelPluginContext) => { return { diff --git a/docs/docs/participate/flow.md b/docs/docs/participate/flow.md index b8b804e123..1b0bc5cd87 100644 --- a/docs/docs/participate/flow.md +++ b/docs/docs/participate/flow.md @@ -2,10 +2,13 @@ title: 研发协作流程 sidebar_position: 2 --- + ## 代码风格 + 引擎项目配置了 eslint 和 stylelint,在每次 git commit 前都会检查代码风格,假如有报错,请修改后再提交。(**严禁 -n 提交,-n 也逃脱不了 github workflow 的 lint 检查,放弃吧,骚年~**) ## 测试机制 + 每次提交代码前,务必本地跑一次单元测试,通过后再提交 MR。 假如涉及新的功能,需要**补充相应的单元测试**,目前引擎核心模块的单测覆盖率都在 80%+,假如降低了覆盖率,将会不予以通过。 @@ -15,12 +18,15 @@ sidebar_position: 2 1. 项目根目录下执行 npm run build 2. 只改了一个包,比如 designer,则在 designer 目录下,执行 npm test 3. (or)改了多个包,则在根目录下执行 npm test + ## commit 风格 + 几点要求: 1. commit message 格式遵循 [ConvensionalCommits](https://www.conventionalcommits.org/en/v1.0.0/#summary) + 2. 请按照一个 bugfix / feature 对应一个 commit,假如不是,请 rebase 后再提交 MR,不要一堆无用的、试验性的 commit。 好处:从引擎的整体 commit 历史来看,会很清晰,**每个 commit 完成一件确定的事,changelog 也能自动生成**。另外,假如因为某个 commit 导致了 bug,也很容易通过 rebase drop 等方式快速修复。 @@ -30,8 +36,8 @@ sidebar_position: 2 - main 分支,最稳定的分支,跟 npm latest 包的内容保持一致 - develop 分支,开发分支,拥有最新的、已经验证过的 feature / bugfix,Pull Request 的**目标合入分支** - release 分支 - - 正式发布分支,命名规则为 release/x.y.z,一般从 develop 拉出来进行发布,x.y.z 为待发布的版本号 - - beta 发布分支,命名规则为 release/x.y.z-beta(\.\d+)?,可以快速验证修改,发布 npm beta 版本。 + - 正式发布分支,命名规则为 release/x.y.z,一般从 develop 拉出来进行发布,x.y.z 为待发布的版本号 + - beta 发布分支,命名规则为 release/x.y.z-beta(\.\d+)?,可以快速验证修改,发布 npm beta 版本。 验证通过后,因为 beta 发布分支上会存在无用的 commit(比如 lerna 修改 package.json 这种),所以不直接 PR 到 develop,而是从 develop 拉分支,从 beta 发布分支 cherry pick 有用的 commit 到新分支,然后 PR 到 develop。 @@ -47,11 +53,12 @@ sidebar_position: 2 - 特殊情况紧急迭代随时发 - 大 Feature 迭代,每年 2 - 4 次 - ### 发布步骤 + > **发布需要权限,如果提 PR 之后着急发布可以**[**加入贡献者交流群**](../participate/#核心贡献者交流)**。** #### 发正式版 + 步骤如下(以发布 1.0.0 版本为例): 1. git checkout develop @@ -75,13 +82,14 @@ sidebar_position: 2 tnpm run sync tnpm run syncOss ``` -6. 更新[发布日志](https://github.com/alibaba/lowcode-engine/releases) +6. 更新[发布日志](https://github.com/fe-lce/lowcode-engine/releases) 7. 合并 release/x.x.x 到 main 分支 8. 合并 main 分支到 develop 分支 如果是发布 beta 版本,步骤如下(以发布 1.0.1 版本为例): #### 发某 y 位版本首个 beta,如 1.1.0-beta.0 + 1. 拉 develop 分支 ```bash git checkout develop @@ -110,6 +118,7 @@ sidebar_position: 2 ``` #### 发某 z 位版本首个 beta,如 1.0.1-beta.0 + 1. 拉 develop 分支 ```bash git checkout develop @@ -138,6 +147,7 @@ sidebar_position: 2 ``` #### 发某版本非首个 beta,如 1.0.1-beta.0 -> 1.0.1-beta.1 + 1. 切换到 release 分支 ```bash git checkout release/1.0.1-beta @@ -150,7 +160,7 @@ sidebar_position: 2 ```bash npm run build ``` -4. 发布,此处需有 @alilc scope 发包权限 ***此处命令与发首个 beta 时有变化*** +4. 发布,此处需有 @alilc scope 发包权限 **_此处命令与发首个 beta 时有变化_** ```bash npm run pub:prerelease ``` @@ -160,9 +170,8 @@ sidebar_position: 2 tnpm run syncOss ``` - - ## DEMO 发布机制 + 1. **修改版本号** 手动修改 package.json 的版本号 2. **build** @@ -182,6 +191,3 @@ sidebar_position: 2 tnpm run sync tnpm run syncOss ``` - -**官网生效** -需要在通过阿里内部系统更新 demo 版本 diff --git a/docs/docs/participate/index.md b/docs/docs/participate/index.md index e09f2ddad2..1a602a73bf 100644 --- a/docs/docs/participate/index.md +++ b/docs/docs/participate/index.md @@ -5,7 +5,7 @@ sidebar_position: 0 ### 环境准备 -开发 LowcodeEngine 需要 Node.js 16+。 +开发 LowcodeEngine 需要 Node.js 18+。 推荐使用 nvm 管理 Node.js,避免权限问题的同时,还能够随时切换当前使用的 Node.js 的版本。 @@ -14,7 +14,7 @@ sidebar_position: 0 #### clone 项目 ``` -git clone git@github.com:alibaba/lowcode-engine.git +git clone git@github.com:fe-lce/lowcode-engine.git cd lowcode-engine ``` @@ -29,23 +29,24 @@ npm install && npm run setup 本质上是将 demo 页面引入的几个 js/css 代理到 engine 项目,可以使用趁手的代理工具,这里推荐 [XSwitch](https://chrome.google.com/webstore/detail/xswitch/idkjhjggpffolpidfkikidcokdkdaogg?hl=en-US)。 本地开发代理规则如下: + ```json { "proxy": [ [ - "https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/(.*)/dist/js/engine-core.js", + "https://uipaas-assets.com/prod/npm/@felce/lowcode-engine/(.*)/dist/js/engine-core.js", "http://localhost:5555/js/AliLowCodeEngine.js" ], [ - "https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/(.*)/dist/css/engine-core.css", + "https://uipaas-assets.com/prod/npm/@felce/lowcode-engine/(.*)/dist/css/engine-core.css", "http://localhost:5555/css/AliLowCodeEngine.css" ], [ - "https?://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/(.*)/dist/js/react-simulator-renderer.js", + "https?://uipaas-assets.com/prod/npm/@felce/lowcode-engine/(.*)/dist/js/react-simulator-renderer.js", "http://localhost:5555/js/ReactSimulatorRenderer.js" ], [ - "https?://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/(.*)/dist/css/react-simulator-renderer.css", + "https?://uipaas-assets.com/prod/npm/@felce/lowcode-engine/(.*)/dist/css/react-simulator-renderer.css", "http://localhost:5555/css/ReactSimulatorRenderer.css" ] ] @@ -62,12 +63,12 @@ npm start 开启代理之后,就可以进行开发调试了。 - ### 贡献低代码引擎文档 #### 开发文档 在 lowcode-engine 目录下执行下面命令 + ``` cd docs @@ -75,7 +76,8 @@ npm start ``` #### 维护方式 -- 官方文档通过 github 管理文档源,官网文档与[主仓库 develop 分支](https://github.com/alibaba/lowcode-engine/tree/develop/docs)保持同步。 + +- 官方文档通过 github 管理文档源,官网文档与[主仓库 develop 分支](https://github.com/fe-lce/lowcode-engine/tree/develop/docs)保持同步。 - 点击每篇文档下发的 `编辑此页` 可直接定位到 github 中位置。 - 欢迎 PR,文档 PR 也会作为贡献者贡献,会用于贡献度统计。 - **文档同步到官方网站由官方人员进行操作**,如有需要可以通过 issue 或 贡献者群与相关人员沟通。 @@ -87,7 +89,6 @@ npm start 使用 vscode 进行编辑的朋友可以安装 vscode 插件 [huacnlee.autocorrect](https://github.com/huacnlee/autocorrect) 辅助文档 lint。 - ### 贡献低代码引擎生态 相关源码详见[NPM 包对应源码位置汇总](/site/docs/guide/appendix/npms) @@ -99,6 +100,7 @@ npm start PR 被合并之后,我们会尽快发布相关的正式版本或者 beta 版本。 ### 加入 Contributor 群 + 提交过 Bugfix 或 Feature 类 PR 的同学,如果有兴趣一起参与维护 LowcodeEngine,我们提供了一个核心贡献者交流群。 1. 可以通过[填写问卷](https://survey.taobao.com/apps/zhiliao/4YEtu9gHF)的方式,参与到其中。 @@ -106,7 +108,7 @@ PR 被合并之后,我们会尽快发布相关的正式版本或者 beta 版 如果你不知道可以贡献什么,可以到源码里搜 TODO 或 FIXME 找找。 -为了使你能够快速上手和熟悉贡献流程,我们这里有个列表 [good first issues](https://github.com/alibaba/lowcode-engine/issues?q=is:open+is:issue+label:%22good+first+issue%22),里面有相对没那么笼统的漏洞,从这开始是个不错的选择。 +为了使你能够快速上手和熟悉贡献流程,我们这里有个列表 [good first issues](https://github.com/fe-lce/lowcode-engine/issues?q=is:open+is:issue+label:%22good+first+issue%22),里面有相对没那么笼统的漏洞,从这开始是个不错的选择。 ### PR 提交注意事项 @@ -115,4 +117,4 @@ PR 被合并之后,我们会尽快发布相关的正式版本或者 beta 版 - 如果你修复了 bug 或者添加了代码,而这些内容需要测试,请添加测试! - 确保通过测试套件(yarn test)。 - 请签订贡献者许可证协议(Contributor License Agreement)。 - > 如已签署 CLA 仍被提示需要签署,[解决办法](/site/docs/faq/faq021) \ No newline at end of file + > 如已签署 CLA 仍被提示需要签署,[解决办法](/site/docs/faq/faq021) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 0aaa4c50f9..3ce8ba033c 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -39,44 +39,42 @@ const config = { presets: [ [ 'classic', - ({ + { docs: { sidebarPath: require.resolve('./config/sidebars.js'), // lastVersion: 'current', - editUrl: - 'https://github.com/alibaba/lowcode-engine/tree/develop/docs/', + editUrl: 'https://github.com/fe-lce/lowcode-engine/tree/develop/docs/', }, theme: { customCss: require.resolve('./src/css/custom.css'), }, - }), + }, ], ], - themeConfig: - ({ - docs: { - sidebar: { - hideable: true, - }, - }, - navbar, - footer: { - // style: 'dark', - copyright: `Copyright © ${new Date().getFullYear()} 阿里巴巴集团, Inc. Built with Docusaurus.`, + themeConfig: { + docs: { + sidebar: { + hideable: true, }, - // 主题切换 - prism: { - theme: lightCodeTheme, - darkTheme: darkCodeTheme, - }, - // 语雀文档导出的图片,会进行 referrer 校验,这里设置关闭,不然加载不了语雀的图片 - metadata: [{ name: 'referrer', content: 'no-referrer' }], - tableOfContents: { - minHeadingLevel: 2, - maxHeadingLevel: 6, - }, - }), + }, + navbar, + footer: { + // style: 'dark', + copyright: `Copyright © ${new Date().getFullYear()} 阿里巴巴集团, Inc. Built with Docusaurus.`, + }, + // 主题切换 + prism: { + theme: lightCodeTheme, + darkTheme: darkCodeTheme, + }, + // 语雀文档导出的图片,会进行 referrer 校验,这里设置关闭,不然加载不了语雀的图片 + metadata: [{ name: 'referrer', content: 'no-referrer' }], + tableOfContents: { + minHeadingLevel: 2, + maxHeadingLevel: 6, + }, + }, themes: [ [ diff --git a/docs/package.json b/docs/package.json index 7facd9db8b..4d3aa2c616 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,5 +1,5 @@ { - "name": "@alilc/lowcode-engine-docs", + "name": "@felce/lowcode-engine-docs", "version": "1.2.31", "description": "低代码引擎版本化文档", "license": "MIT", @@ -57,7 +57,7 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main" }, "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" } diff --git a/lerna.json b/lerna.json index 7fad993f66..d0d5e9aea2 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "4.0.0", - "version": "1.3.2", + "version": "1.4.0", "npmClient": "yarn", "useWorkspaces": true, "packages": [ diff --git a/modules/code-generator/CHANGELOG.md b/modules/code-generator/CHANGELOG.md index 62527d0229..8a6c546cd8 100644 --- a/modules/code-generator/CHANGELOG.md +++ b/modules/code-generator/CHANGELOG.md @@ -2,279 +2,265 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. -### [1.0.7-beta.2](https://github.com/alibaba/lowcode-engine/compare/@alilc/lowcode-code-generator@1.0.3...@alilc/lowcode-code-generator@1.0.7-beta.2) (2022-11-24) +### [1.0.7-beta.2](https://github.com/fe-lce/lowcode-engine/compare/@felce/lowcode-code-generator@1.0.3...@felce/lowcode-code-generator@1.0.7-beta.2) (2022-11-24) ### Bug Fixes -* 🐛 解决 react 中 jsx 出码的时候对于循环数据漏包 __$evalArray 的问题 ([3b9b177](https://github.com/alibaba/lowcode-engine/commit/3b9b177b052169cd0c1078cf8b488f04cb374dac)) -* 🐛 解决出码缺乏对于 i18n 数据的 params 的处理的问题 ([2cf788c](https://github.com/alibaba/lowcode-engine/commit/2cf788c1716ae63fef20004348c59a5a65c6b3d2)), closes [#288](https://github.com/alibaba/lowcode-engine/issues/288) -* 🐛 解决小程序环境没有 window, 而 rax 出码中却默认在 __$eval 中用到 window 的问题 ([ce531ae](https://github.com/alibaba/lowcode-engine/commit/ce531aeb457711fac92d828b431cfc3d643b3682)) -* add support for jsx expression ([453e069](https://github.com/alibaba/lowcode-engine/commit/453e0699ece06d98e59227e23248baf1de4082aa)) -* 修复生成的 icejs 项目不支持 constants 的问题, fixes [#1259](https://github.com/alibaba/lowcode-engine/issues/1259) ([a079fbc](https://github.com/alibaba/lowcode-engine/commit/a079fbc256f8275e8a69eb6d8abb6f6b08179578)) -* 修正 react 框架出码中在严格模式对 methods 和 context 的处理 ([b1a6100](https://github.com/alibaba/lowcode-engine/commit/b1a61006bba4292790899c7c49c9c611a9384472)) -### [1.0.7-beta.1](https://github.com/alibaba/lowcode-engine/compare/@alilc/lowcode-code-generator@1.0.7-beta.0...@alilc/lowcode-code-generator@1.0.7-beta.1) (2022-10-26) +- 🐛 解决 react 中 jsx 出码的时候对于循环数据漏包 \_\_$evalArray 的问题 ([3b9b177](https://github.com/fe-lce/lowcode-engine/commit/3b9b177b052169cd0c1078cf8b488f04cb374dac)) +- 🐛 解决出码缺乏对于 i18n 数据的 params 的处理的问题 ([2cf788c](https://github.com/fe-lce/lowcode-engine/commit/2cf788c1716ae63fef20004348c59a5a65c6b3d2)), closes [#288](https://github.com/fe-lce/lowcode-engine/issues/288) +- 🐛 解决小程序环境没有 window, 而 rax 出码中却默认在 \_\_$eval 中用到 window 的问题 ([ce531ae](https://github.com/fe-lce/lowcode-engine/commit/ce531aeb457711fac92d828b431cfc3d643b3682)) +- add support for jsx expression ([453e069](https://github.com/fe-lce/lowcode-engine/commit/453e0699ece06d98e59227e23248baf1de4082aa)) +- 修复生成的 icejs 项目不支持 constants 的问题, fixes [#1259](https://github.com/fe-lce/lowcode-engine/issues/1259) ([a079fbc](https://github.com/fe-lce/lowcode-engine/commit/a079fbc256f8275e8a69eb6d8abb6f6b08179578)) +- 修正 react 框架出码中在严格模式对 methods 和 context 的处理 ([b1a6100](https://github.com/fe-lce/lowcode-engine/commit/b1a61006bba4292790899c7c49c9c611a9384472)) +### [1.0.7-beta.1](https://github.com/fe-lce/lowcode-engine/compare/@felce/lowcode-code-generator@1.0.7-beta.0...@felce/lowcode-code-generator@1.0.7-beta.1) (2022-10-26) ### Bug Fixes -* fix empty string lost when generate variable ([2cf74cd](https://github.com/alibaba/lowcode-engine/commit/2cf74cd04b4f48a3501d37329d39784f6964366a)) +- fix empty string lost when generate variable ([2cf74cd](https://github.com/fe-lce/lowcode-engine/commit/2cf74cd04b4f48a3501d37329d39784f6964366a)) -### [1.0.7-beta.0](https://github.com/alibaba/lowcode-engine/compare/@alilc/lowcode-code-generator@1.0.6-beta.0...@alilc/lowcode-code-generator@1.0.7-beta.0) (2022-10-25) - -### [1.0.6-beta.0](https://github.com/alibaba/lowcode-engine/compare/@alilc/lowcode-code-generator@1.0.3...@alilc/lowcode-code-generator@1.0.6-beta.0) (2022-10-25) +### [1.0.7-beta.0](https://github.com/fe-lce/lowcode-engine/compare/@felce/lowcode-code-generator@1.0.6-beta.0...@felce/lowcode-code-generator@1.0.7-beta.0) (2022-10-25) +### [1.0.6-beta.0](https://github.com/fe-lce/lowcode-engine/compare/@felce/lowcode-code-generator@1.0.3...@felce/lowcode-code-generator@1.0.6-beta.0) (2022-10-25) ### Features -* 🎸 设计态支持数据源引擎配置 ([04631f8](https://github.com/alibaba/lowcode-engine/commit/04631f813782dbf6d175f51c40ccc75ca4c099d2)) -* 大纲树支持节点过滤 ([f30db20](https://github.com/alibaba/lowcode-engine/commit/f30db20606f5f2fdac0017305b1dda7ab2258c4b)) -* 为 renderer 追加 displayName,以支持后续的反射功能 ([6399cce](https://github.com/alibaba/lowcode-engine/commit/6399cce05ae494dac6facf4366949b0b97576079)) -* 资产包支持一个package从另一个package异步导出 ([#1150](https://github.com/alibaba/lowcode-engine/issues/1150)) ([6b78157](https://github.com/alibaba/lowcode-engine/commit/6b78157b211d6eabf60297b9ce980a3e10cc8272)) -* add availableActions for ComponentMeta ([de1f60b](https://github.com/alibaba/lowcode-engine/commit/de1f60bbee157267e2c2212df1077cc49ce506f4)) -* add code coverage action ([ed3ddcf](https://github.com/alibaba/lowcode-engine/commit/ed3ddcf5c942a8e78e1f247e41d4159da97e75a8)) -* add componentMeta getter for setingPropEntry ([2f8b954](https://github.com/alibaba/lowcode-engine/commit/2f8b9545de0210260001a832b52f608238ac4191)) -* add expanded to shell SettingPropEntry ([534e294](https://github.com/alibaba/lowcode-engine/commit/534e29429d445d97c71d95d4c4e492868527bb6b)) -* add flag createIfNode for ShellNode#getProp ([152a24d](https://github.com/alibaba/lowcode-engine/commit/152a24d65528d0a3b7990c9aa87e6d8d09aa9b2a)) -* add getComponentsMap() for DocumentModel ([f956645](https://github.com/alibaba/lowcode-engine/commit/f9566454ef83eb4c48b68d63a766c3d0ff927c73)) -* add getExtraPropValue setExtraPropValue to shell SettingPropEntry ([70e7c1c](https://github.com/alibaba/lowcode-engine/commit/70e7c1c2e8998e80d58447759efdf651105724a9)) -* add id setter for DocumentModel ([941ae05](https://github.com/alibaba/lowcode-engine/commit/941ae0592586334694c48197aaa6692d49cefbce)) -* add importSchema event for documentModel ([4b8ec09](https://github.com/alibaba/lowcode-engine/commit/4b8ec09e86e3950a9d4066c28e681a59273b4c93)) -* add isGroup & items to shell SettingPropEntry ([7b76ff3](https://github.com/alibaba/lowcode-engine/commit/7b76ff357e4e638454c31a9b1324fb68966ec522)) -* add mergeChldren API for shell node ([a47d4ee](https://github.com/alibaba/lowcode-engine/commit/a47d4eea28cf4479e3b3a2bd1d194a6433666825)) -* add onMountNode event for DocumentModel ([dcc247c](https://github.com/alibaba/lowcode-engine/commit/dcc247c7d54f6af2ed36d46bfd79c7eacf7bd604)) -* add renderer for simulatorHost ([1cfc8d6](https://github.com/alibaba/lowcode-engine/commit/1cfc8d668b8897ef3a53c11520312cc6d18338f9)) -* add script for synchronizing packages to intranet registry ([b4f463e](https://github.com/alibaba/lowcode-engine/commit/b4f463e7d45f7b476de04bd4d98ad9f74d53cf13)) -* add scrollToNode for simulator host ([#1075](https://github.com/alibaba/lowcode-engine/issues/1075)) ([0bcd9ff](https://github.com/alibaba/lowcode-engine/commit/0bcd9ff78227aeddaf2fdc22d10fbd662fed91d3)) -* add setVisible for Node ([ba90327](https://github.com/alibaba/lowcode-engine/commit/ba90327eac0f5f82f6349bb9a7684bf51259e9c9)) -* add showArea & hideArea method for skeleton ([8f6b53e](https://github.com/alibaba/lowcode-engine/commit/8f6b53e67d89ee7af754132f0994a759522b3821)) -* add slotNode for shell prop ([d9a44c5](https://github.com/alibaba/lowcode-engine/commit/d9a44c5de7861e9180567b4afb787e381cefac61)) -* add some features ([18d1a4f](https://github.com/alibaba/lowcode-engine/commit/18d1a4fe1d952bcd4715e693def09fee94da49a5)) -* add some necessary methods and attributes ([4fd7f27](https://github.com/alibaba/lowcode-engine/commit/4fd7f27f8eb33b66324ede279b412940fc1f7032)) -* add some params for onDragstart & onDrag & onDragend ([d1c9838](https://github.com/alibaba/lowcode-engine/commit/d1c9838343ba1bdd4c02c1cfbf1f920dd8c87e7d)) -* add top attrbute for Shell SettingPropEntry ([51aca3d](https://github.com/alibaba/lowcode-engine/commit/51aca3d330b6483c05b71867f1b362a9f5db6cfe)) -* added lowcode engine standard specs ([f25feba](https://github.com/alibaba/lowcode-engine/commit/f25feba63f181efa83f1a8dff530e1c39ab1b34c)) -* added lowcode engine standard specs ([57df803](https://github.com/alibaba/lowcode-engine/commit/57df803179ca9cec4e8ab1dac1be577175732e65)) -* added thisRequiredInJSE API to control whether JSExpression expression access context must use this ([#702](https://github.com/alibaba/lowcode-engine/issues/702)) ([da7f77e](https://github.com/alibaba/lowcode-engine/commit/da7f77ee91b3bf441a4a57614872df32d6a1d041)) -* assetLoader loda scripts with async=false ([f6ad4a1](https://github.com/alibaba/lowcode-engine/commit/f6ad4a157df8c0ff7db327f4770f454998693d9a)) -* change loop sertter config, set defaultValue prop to JsonSetter ([aa6b9c8](https://github.com/alibaba/lowcode-engine/commit/aa6b9c8f7a5353771af9f46216310f044e57c533)) -* cp dist files of simulator-renderer to that of engine ([03c5397](https://github.com/alibaba/lowcode-engine/commit/03c53971df6de8c35620fd77743ac4f57a82d323)) -* export nodeChildrenSymbol && remove some unnecessary editor.set ([e83adce](https://github.com/alibaba/lowcode-engine/commit/e83adcee815eea73b6b1ed4f43f4d684c11818ca)) -* fix render-core leaf hoc component condition config should get from leaf exportSchema fn ([85704c3](https://github.com/alibaba/lowcode-engine/commit/85704c36946191a1b88db789cfac59e9d027a371)) -* low-code components support lifecycle and function execution ([176583f](https://github.com/alibaba/lowcode-engine/commit/176583f48af573d30c0d2c36faa3d901b0541c06)) -* **material-parser:** check module before install it; fix default value issue in ts parser ([fc452f7](https://github.com/alibaba/lowcode-engine/commit/fc452f7166f02acfba6076c1a9425e6f5880b5f6)) -* modify the output method of rendering module parsing errors ([8255b79](https://github.com/alibaba/lowcode-engine/commit/8255b7945836ee5d25fae73913faa6d0af7b3ff3)) -* pass e to customizeIgnoreSelectors ([900b239](https://github.com/alibaba/lowcode-engine/commit/900b2394323e85f0dce5df83dfc773f96da23e24)) -* refine nesting drawer ([4c032d0](https://github.com/alibaba/lowcode-engine/commit/4c032d0d0ead9731c038bd62dccc4a7d96435183)) -* refine nesting drawer ([94a211e](https://github.com/alibaba/lowcode-engine/commit/94a211e2795f74721cfd2ae3ff38a1d3607e9cd0)) -* refine pop drawer ([abf8fae](https://github.com/alibaba/lowcode-engine/commit/abf8fae3ef4d62b5688362e1b98f1b508a207029)) -* requestHandlersMap should be optional ([ee7160e](https://github.com/alibaba/lowcode-engine/commit/ee7160ea3c625d421c07730ef51711b8f14392a0)) -* return unbind function for onChangeDetecting & onChangeSelection ([30267cb](https://github.com/alibaba/lowcode-engine/commit/30267cb173fca2cd80a61450b9f2fe2bceac0f06)) -* support for hiding settings tabs when there is only one item ([#669](https://github.com/alibaba/lowcode-engine/issues/669)) ([cbd95a1](https://github.com/alibaba/lowcode-engine/commit/cbd95a1778415406670f37507ce957af6b3ecd4a)) -* support for NotFoundComponent design state is optional ([#1013](https://github.com/alibaba/lowcode-engine/issues/1013)) ([d3c891e](https://github.com/alibaba/lowcode-engine/commit/d3c891e2a46d138e31c81a7f9b804a8240154df5)) -* support opening document with id ([3f7c0cd](https://github.com/alibaba/lowcode-engine/commit/3f7c0cd5191b7924f2630c58e6439f4d4a936ac9)) -* support SPA mode ([1f9150e](https://github.com/alibaba/lowcode-engine/commit/1f9150e4b260d522bd7cb31497069b700a1e8576)) -* sync utils/constants ([#506](https://github.com/alibaba/lowcode-engine/issues/506)) ([2871b5b](https://github.com/alibaba/lowcode-engine/commit/2871b5ba4c3dbf1ed76bf4d6359fb457190a9b22)) -* the tips when dragging a component from the component panel same with the moving component ([dbe0764](https://github.com/alibaba/lowcode-engine/commit/dbe0764ff4901450f03ca56b62167fbc87d2524a)) - +- 🎸 设计态支持数据源引擎配置 ([04631f8](https://github.com/fe-lce/lowcode-engine/commit/04631f813782dbf6d175f51c40ccc75ca4c099d2)) +- 大纲树支持节点过滤 ([f30db20](https://github.com/fe-lce/lowcode-engine/commit/f30db20606f5f2fdac0017305b1dda7ab2258c4b)) +- 为 renderer 追加 displayName,以支持后续的反射功能 ([6399cce](https://github.com/fe-lce/lowcode-engine/commit/6399cce05ae494dac6facf4366949b0b97576079)) +- 资产包支持一个package从另一个package异步导出 ([#1150](https://github.com/fe-lce/lowcode-engine/issues/1150)) ([6b78157](https://github.com/fe-lce/lowcode-engine/commit/6b78157b211d6eabf60297b9ce980a3e10cc8272)) +- add availableActions for ComponentMeta ([de1f60b](https://github.com/fe-lce/lowcode-engine/commit/de1f60bbee157267e2c2212df1077cc49ce506f4)) +- add code coverage action ([ed3ddcf](https://github.com/fe-lce/lowcode-engine/commit/ed3ddcf5c942a8e78e1f247e41d4159da97e75a8)) +- add componentMeta getter for setingPropEntry ([2f8b954](https://github.com/fe-lce/lowcode-engine/commit/2f8b9545de0210260001a832b52f608238ac4191)) +- add expanded to shell SettingPropEntry ([534e294](https://github.com/fe-lce/lowcode-engine/commit/534e29429d445d97c71d95d4c4e492868527bb6b)) +- add flag createIfNode for ShellNode#getProp ([152a24d](https://github.com/fe-lce/lowcode-engine/commit/152a24d65528d0a3b7990c9aa87e6d8d09aa9b2a)) +- add getComponentsMap() for DocumentModel ([f956645](https://github.com/fe-lce/lowcode-engine/commit/f9566454ef83eb4c48b68d63a766c3d0ff927c73)) +- add getExtraPropValue setExtraPropValue to shell SettingPropEntry ([70e7c1c](https://github.com/fe-lce/lowcode-engine/commit/70e7c1c2e8998e80d58447759efdf651105724a9)) +- add id setter for DocumentModel ([941ae05](https://github.com/fe-lce/lowcode-engine/commit/941ae0592586334694c48197aaa6692d49cefbce)) +- add importSchema event for documentModel ([4b8ec09](https://github.com/fe-lce/lowcode-engine/commit/4b8ec09e86e3950a9d4066c28e681a59273b4c93)) +- add isGroup & items to shell SettingPropEntry ([7b76ff3](https://github.com/fe-lce/lowcode-engine/commit/7b76ff357e4e638454c31a9b1324fb68966ec522)) +- add mergeChldren API for shell node ([a47d4ee](https://github.com/fe-lce/lowcode-engine/commit/a47d4eea28cf4479e3b3a2bd1d194a6433666825)) +- add onMountNode event for DocumentModel ([dcc247c](https://github.com/fe-lce/lowcode-engine/commit/dcc247c7d54f6af2ed36d46bfd79c7eacf7bd604)) +- add renderer for simulatorHost ([1cfc8d6](https://github.com/fe-lce/lowcode-engine/commit/1cfc8d668b8897ef3a53c11520312cc6d18338f9)) +- add script for synchronizing packages to intranet registry ([b4f463e](https://github.com/fe-lce/lowcode-engine/commit/b4f463e7d45f7b476de04bd4d98ad9f74d53cf13)) +- add scrollToNode for simulator host ([#1075](https://github.com/fe-lce/lowcode-engine/issues/1075)) ([0bcd9ff](https://github.com/fe-lce/lowcode-engine/commit/0bcd9ff78227aeddaf2fdc22d10fbd662fed91d3)) +- add setVisible for Node ([ba90327](https://github.com/fe-lce/lowcode-engine/commit/ba90327eac0f5f82f6349bb9a7684bf51259e9c9)) +- add showArea & hideArea method for skeleton ([8f6b53e](https://github.com/fe-lce/lowcode-engine/commit/8f6b53e67d89ee7af754132f0994a759522b3821)) +- add slotNode for shell prop ([d9a44c5](https://github.com/fe-lce/lowcode-engine/commit/d9a44c5de7861e9180567b4afb787e381cefac61)) +- add some features ([18d1a4f](https://github.com/fe-lce/lowcode-engine/commit/18d1a4fe1d952bcd4715e693def09fee94da49a5)) +- add some necessary methods and attributes ([4fd7f27](https://github.com/fe-lce/lowcode-engine/commit/4fd7f27f8eb33b66324ede279b412940fc1f7032)) +- add some params for onDragstart & onDrag & onDragend ([d1c9838](https://github.com/fe-lce/lowcode-engine/commit/d1c9838343ba1bdd4c02c1cfbf1f920dd8c87e7d)) +- add top attrbute for Shell SettingPropEntry ([51aca3d](https://github.com/fe-lce/lowcode-engine/commit/51aca3d330b6483c05b71867f1b362a9f5db6cfe)) +- added lowcode engine standard specs ([f25feba](https://github.com/fe-lce/lowcode-engine/commit/f25feba63f181efa83f1a8dff530e1c39ab1b34c)) +- added lowcode engine standard specs ([57df803](https://github.com/fe-lce/lowcode-engine/commit/57df803179ca9cec4e8ab1dac1be577175732e65)) +- added thisRequiredInJSE API to control whether JSExpression expression access context must use this ([#702](https://github.com/fe-lce/lowcode-engine/issues/702)) ([da7f77e](https://github.com/fe-lce/lowcode-engine/commit/da7f77ee91b3bf441a4a57614872df32d6a1d041)) +- assetLoader loda scripts with async=false ([f6ad4a1](https://github.com/fe-lce/lowcode-engine/commit/f6ad4a157df8c0ff7db327f4770f454998693d9a)) +- change loop sertter config, set defaultValue prop to JsonSetter ([aa6b9c8](https://github.com/fe-lce/lowcode-engine/commit/aa6b9c8f7a5353771af9f46216310f044e57c533)) +- cp dist files of simulator-renderer to that of engine ([03c5397](https://github.com/fe-lce/lowcode-engine/commit/03c53971df6de8c35620fd77743ac4f57a82d323)) +- export nodeChildrenSymbol && remove some unnecessary editor.set ([e83adce](https://github.com/fe-lce/lowcode-engine/commit/e83adcee815eea73b6b1ed4f43f4d684c11818ca)) +- fix render-core leaf hoc component condition config should get from leaf exportSchema fn ([85704c3](https://github.com/fe-lce/lowcode-engine/commit/85704c36946191a1b88db789cfac59e9d027a371)) +- low-code components support lifecycle and function execution ([176583f](https://github.com/fe-lce/lowcode-engine/commit/176583f48af573d30c0d2c36faa3d901b0541c06)) +- **material-parser:** check module before install it; fix default value issue in ts parser ([fc452f7](https://github.com/fe-lce/lowcode-engine/commit/fc452f7166f02acfba6076c1a9425e6f5880b5f6)) +- modify the output method of rendering module parsing errors ([8255b79](https://github.com/fe-lce/lowcode-engine/commit/8255b7945836ee5d25fae73913faa6d0af7b3ff3)) +- pass e to customizeIgnoreSelectors ([900b239](https://github.com/fe-lce/lowcode-engine/commit/900b2394323e85f0dce5df83dfc773f96da23e24)) +- refine nesting drawer ([4c032d0](https://github.com/fe-lce/lowcode-engine/commit/4c032d0d0ead9731c038bd62dccc4a7d96435183)) +- refine nesting drawer ([94a211e](https://github.com/fe-lce/lowcode-engine/commit/94a211e2795f74721cfd2ae3ff38a1d3607e9cd0)) +- refine pop drawer ([abf8fae](https://github.com/fe-lce/lowcode-engine/commit/abf8fae3ef4d62b5688362e1b98f1b508a207029)) +- requestHandlersMap should be optional ([ee7160e](https://github.com/fe-lce/lowcode-engine/commit/ee7160ea3c625d421c07730ef51711b8f14392a0)) +- return unbind function for onChangeDetecting & onChangeSelection ([30267cb](https://github.com/fe-lce/lowcode-engine/commit/30267cb173fca2cd80a61450b9f2fe2bceac0f06)) +- support for hiding settings tabs when there is only one item ([#669](https://github.com/fe-lce/lowcode-engine/issues/669)) ([cbd95a1](https://github.com/fe-lce/lowcode-engine/commit/cbd95a1778415406670f37507ce957af6b3ecd4a)) +- support for NotFoundComponent design state is optional ([#1013](https://github.com/fe-lce/lowcode-engine/issues/1013)) ([d3c891e](https://github.com/fe-lce/lowcode-engine/commit/d3c891e2a46d138e31c81a7f9b804a8240154df5)) +- support opening document with id ([3f7c0cd](https://github.com/fe-lce/lowcode-engine/commit/3f7c0cd5191b7924f2630c58e6439f4d4a936ac9)) +- support SPA mode ([1f9150e](https://github.com/fe-lce/lowcode-engine/commit/1f9150e4b260d522bd7cb31497069b700a1e8576)) +- sync utils/constants ([#506](https://github.com/fe-lce/lowcode-engine/issues/506)) ([2871b5b](https://github.com/fe-lce/lowcode-engine/commit/2871b5ba4c3dbf1ed76bf4d6359fb457190a9b22)) +- the tips when dragging a component from the component panel same with the moving component ([dbe0764](https://github.com/fe-lce/lowcode-engine/commit/dbe0764ff4901450f03ca56b62167fbc87d2524a)) ### Bug Fixes -* 🐛 解决 react 中 jsx 出码的时候对于循环数据漏包 __$evalArray 的问题 ([3b9b177](https://github.com/alibaba/lowcode-engine/commit/3b9b177b052169cd0c1078cf8b488f04cb374dac)) -* 🐛 解决出码缺乏对于 i18n 数据的 params 的处理的问题 ([2cf788c](https://github.com/alibaba/lowcode-engine/commit/2cf788c1716ae63fef20004348c59a5a65c6b3d2)), closes [#288](https://github.com/alibaba/lowcode-engine/issues/288) -* 🐛 解决小程序环境没有 window, 而 rax 出码中却默认在 __$eval 中用到 window 的问题 ([ce531ae](https://github.com/alibaba/lowcode-engine/commit/ce531aeb457711fac92d828b431cfc3d643b3682)) -* 🐛 修复数据源引擎请求处理器映射严格模式下被过滤的问题 ([75626d8](https://github.com/alibaba/lowcode-engine/commit/75626d877db017b8862b1d5e64d75f3af7ff667a)) -* 🐛 修正 i18n 里面的一个参数命名问题 ([20c6fca](https://github.com/alibaba/lowcode-engine/commit/20c6fca03e99b11fa5c257cbbda0d4d23f410090)) -* 新元素无法在大纲树拖拽 ([3d41fd5](https://github.com/alibaba/lowcode-engine/commit/3d41fd5d0783048a7cfb54c6f80d058856153d25)) -* 修复React17选中组件bug ([750d282](https://github.com/alibaba/lowcode-engine/commit/750d282c03a880204fefdef01e180510465b82f8)) -* 修正 react 框架出码中在严格模式对 methods 和 context 的处理 ([b1a6100](https://github.com/alibaba/lowcode-engine/commit/b1a61006bba4292790899c7c49c9c611a9384472)) -* 左侧抽屉固定模式层级不足 ([c657cee](https://github.com/alibaba/lowcode-engine/commit/c657cee0694e3126dee89588a2aa17c4e118f786)) -* add lowcode-designer, lowcode-utils dependencies ([d250242](https://github.com/alibaba/lowcode-engine/commit/d2502427ca988881747a35bd8da49f024939b833)) -* add support for jsx expression ([1043ef8](https://github.com/alibaba/lowcode-engine/commit/1043ef82b1e9ceefc3b74fd21eb28e9a740bd1db)) -* addon-combine affect metadata unexpectedly ([fc5fbc6](https://github.com/alibaba/lowcode-engine/commit/fc5fbc63a04a32bc887754f32e74c76149d74b05)) -* adjust synchronize-order of packages ([81a7304](https://github.com/alibaba/lowcode-engine/commit/81a73049bd848524e1156761ded08ddf325863ba)) -* change typescript type export to export type ([50e4a03](https://github.com/alibaba/lowcode-engine/commit/50e4a03b7d810131ce413cc057b43d4a726f1ebe)) -* change typescript type export to export type ([573504b](https://github.com/alibaba/lowcode-engine/commit/573504b0e3537ca60d234ce2b2f3feedb323405e)) -* declare parameter appHelper for valid engine options ([058a842](https://github.com/alibaba/lowcode-engine/commit/058a84226af8ca19d8c7d63599d80d0cdf70281c)) -* defaultValue should be evaluated inspite of condition result is falsy, fixes [#1045](https://github.com/alibaba/lowcode-engine/issues/1045) ([fcfce3c](https://github.com/alibaba/lowcode-engine/commit/fcfce3cbeb5a53600c40aea07ffef19c9c9591c4)) -* delete the defaultValue configuration outside the loop ([acf7449](https://github.com/alibaba/lowcode-engine/commit/acf7449ca231d45e8ed7e1d9416817ea11b1266f)) -* delete unused typescript types ([63f5d2c](https://github.com/alibaba/lowcode-engine/commit/63f5d2ca3e0bda92898fd0df28c9500707812082)) -* delete unused typescript types ([2432aed](https://github.com/alibaba/lowcode-engine/commit/2432aed83d55407d2f8b5f94910ada7ea78bb59e)) -* designer/loadIncrementalAssets await Sequential ([#841](https://github.com/alibaba/lowcode-engine/issues/841)) ([8232424](https://github.com/alibaba/lowcode-engine/commit/823242469743d235923b3b946ec7d2db70887ead)) -* error thrown when triggering undo after save schema on SchemaPane ([9be46e7](https://github.com/alibaba/lowcode-engine/commit/9be46e7b34e3a40cbc489dbae4bfd0915c2090e3)) -* fallback focusNode to root if empty ([a9a118f](https://github.com/alibaba/lowcode-engine/commit/a9a118fe6e79080245c6eea42ed26772b7c784ca)) -* **filter:** unique key prop warning ([3fe6e41](https://github.com/alibaba/lowcode-engine/commit/3fe6e41536cd3a9b9c7eaca5b353de4bd1f91b11)) -* **filter:** unique key prop warning ([06e6920](https://github.com/alibaba/lowcode-engine/commit/06e6920602bdf21b6e1ffe5cfa3dfe4856e7c57e)) -* fix css resources with parameters not loading correctly ([f859752](https://github.com/alibaba/lowcode-engine/commit/f85975211814147d40ae5330a76cb21cb6c66916)) -* fix css resources with parameters not loading correctly ([9a5a04a](https://github.com/alibaba/lowcode-engine/commit/9a5a04ac9560fb6a51bf4e0ed8ea446381d39c35)) -* fix dataSource needs to be compatible due to empty schema ([98bc477](https://github.com/alibaba/lowcode-engine/commit/98bc477d80dbf7993f89befdb42762d78a55fb1b)) -* fix displayName spell mistake ([2b2bcbd](https://github.com/alibaba/lowcode-engine/commit/2b2bcbdaebde6a3ce974072f586386ef7ef3497c)) -* fix internal project.getSchema default stage is error ([0d40db2](https://github.com/alibaba/lowcode-engine/commit/0d40db2581f4fe5a9e22f763f21aec641e366c34)) -* fix lint issues for renderer-core/renderer/base ([d85437d](https://github.com/alibaba/lowcode-engine/commit/d85437d4af1043371e27dfde98cecf914b93a126)) -* fix lint issues for renderer-core/renderer/base ([4b59190](https://github.com/alibaba/lowcode-engine/commit/4b59190c7f9d518bc7efac44b7eeee73f1b5d177)) -* fix low-code component rendering problems: 1. thisRequiredInJSE does not take effect 2. jsx components cannot obtain source components ([5dd4625](https://github.com/alibaba/lowcode-engine/commit/5dd462544fbbbccfa97165f2bcfeed8629fab2a3)) -* fix material-spec demo ([438cccd](https://github.com/alibaba/lowcode-engine/commit/438cccd58e4341638070c1d8b2d4e78e4e20e3fb)) -* fix misused doc urls ([16a8857](https://github.com/alibaba/lowcode-engine/commit/16a88578634b9da2f04698df5ca5a5e69151bb97)) -* fix monitor utils incorrect assignment method ([bf280c6](https://github.com/alibaba/lowcode-engine/commit/bf280c6fa1e46d084fc8f20323164816fad4076f)) -* fix outline-pane invisible occasionally when dragging tree node ([031c7f2](https://github.com/alibaba/lowcode-engine/commit/031c7f25f10a6cfebfc7929c9226f4e4167a359f)) -* fix outline-tree initialization failed ([a2d5c6f](https://github.com/alibaba/lowcode-engine/commit/a2d5c6fd90ca0226bbbfea01a4b28c8b8d307a78)) -* fix render module state expression initialization exception ([5bd68ee](https://github.com/alibaba/lowcode-engine/commit/5bd68ee6b448fa58b022870b3f8175d8b77febde)) -* fix render module state expression initialization exception ([9c545cc](https://github.com/alibaba/lowcode-engine/commit/9c545cca6004f65e2f206ea001cefa3fa3cfa807)) -* fix setter hooks error ([8a3a0b8](https://github.com/alibaba/lowcode-engine/commit/8a3a0b824162e25a930711c6fef511b4b369e897)) -* fix test case failures of designer ([4b0521a](https://github.com/alibaba/lowcode-engine/commit/4b0521a47494f78e120f75021e0a076fb00ce53e)) -* Fix the conversion failure of some props expressions under Slot props of low-code components ([7db5461](https://github.com/alibaba/lowcode-engine/commit/7db5461706c739fac673b2466bc2fda7661242e4)) -* fix the leaf hoc component fails to monitor Node changes, and modify the logic for get node ([6ee6b07](https://github.com/alibaba/lowcode-engine/commit/6ee6b07a10ba4aac583def52d8ff1fa78d111d0b)) -* fix the leaf hoc component fails to monitor Node changes, and modify the logic for get node ([f400172](https://github.com/alibaba/lowcode-engine/commit/f4001728259047b09db75d76a8c3ef1e1bcb4e0a)) -* fix the problem that material.getComponentMetasMap returns the wrong result ([e02933c](https://github.com/alibaba/lowcode-engine/commit/e02933c18bc15519b2eba8ad946282502a509611)) -* Fix the rendering error caused by incorrect key value when configuring the loop ([1026763](https://github.com/alibaba/lowcode-engine/commit/1026763dc5a77d4395a1e86e5a0084ab4fb4230c)) -* fix the unit test failure problem caused by thisRequiredInJSE modification ([c2c59b7](https://github.com/alibaba/lowcode-engine/commit/c2c59b7ff72ba06156bbcdb952262739d6188209)) -* fix unnecessary props calculation ([f1fed75](https://github.com/alibaba/lowcode-engine/commit/f1fed75f39be8289ede1ec558b04428a69e25b5f)) -* fixed an issue where materials would be rendered multiple times ([9d187cc](https://github.com/alibaba/lowcode-engine/commit/9d187ccb7de55857e861d3fc881c610506872d03)) -* fixed an issue where materials would be rendered multiple times ([64cc328](https://github.com/alibaba/lowcode-engine/commit/64cc3283c15342151a8f93c46a276681f3575153)) -* fixed focusNodeSelector configuration not taking effect ([9beae9c](https://github.com/alibaba/lowcode-engine/commit/9beae9c3269901bf03a29033121c7d480571bce5)) -* fixed the issue that thisRequiredInJSE did not take effect in some scenarios ([7e5a919](https://github.com/alibaba/lowcode-engine/commit/7e5a919f9352397f11741fd911495996469c0256)) -* in ES require changed to import ([b4d7d6d](https://github.com/alibaba/lowcode-engine/commit/b4d7d6d8c290a335a2c1f60731d4417b23444941)) -* in ES require changed to import ([7c8cd36](https://github.com/alibaba/lowcode-engine/commit/7c8cd36a10a7caa61de31a15abd93ab8a97fbe08)) -* leaf should be type of ShellNode other than InnerNode ([5bb8cf5](https://github.com/alibaba/lowcode-engine/commit/5bb8cf5d12d38d70b69fa28deb2f8aa0afa9b9b9)) -* lowcode component exec lifecycle has error ([f99a47e](https://github.com/alibaba/lowcode-engine/commit/f99a47e502080134454795f5e361cfa4fba3f03b)) -* lowcode component leaf dont have export prop, exec leaf.export make error ([9d51dcd](https://github.com/alibaba/lowcode-engine/commit/9d51dcdae38850be0206861f2cae74ca68805c25)) -* missing engine options config info ([a79875c](https://github.com/alibaba/lowcode-engine/commit/a79875cf8698d3912b50526d97f6ac72e9a21fc9)) -* missing engine options config info ([9ccded0](https://github.com/alibaba/lowcode-engine/commit/9ccded006ef44cd538abaa140250e519243bf090)) -* npm run clean error in windows ([a176e9d](https://github.com/alibaba/lowcode-engine/commit/a176e9d245981fb5718c8d144f477202b3796be6)) -* project event listeners will not be invoked sometimes ([a0c772f](https://github.com/alibaba/lowcode-engine/commit/a0c772fb903cf5eb9e0b811b64bbe3846d4ba8ac)) -* project.exportSchema api lack stage param & setAssets should be a async fn ([0ea76a7](https://github.com/alibaba/lowcode-engine/commit/0ea76a746fac8ea8e7b999d42434c468c85d6372)) -* project.exportSchema should export componentsMap of all documents ([969a130](https://github.com/alibaba/lowcode-engine/commit/969a130b373fb028f8051e96cb9d79f1de0a2a1c)) -* removed incorrectly calling childWhitelist hook logic during drag and drop ([#1141](https://github.com/alibaba/lowcode-engine/issues/1141)) ([6576346](https://github.com/alibaba/lowcode-engine/commit/6576346b9185bedb090be9c84129e077cf5389b3)) -* renderer not rendering correct components when loading components with loadAsyncLibrary api ([9b3b4f9](https://github.com/alibaba/lowcode-engine/commit/9b3b4f9b0e35ef3ea2f0117f0cdb2254e15d5389)) -* should pass index param when creating a Prop instance under a list type Prop instance, fix [#780](https://github.com/alibaba/lowcode-engine/issues/780) ([a8de3f2](https://github.com/alibaba/lowcode-engine/commit/a8de3f299c7b26fa939d2b2ea1428143e2b5fb01)) -* simulator eclipses setting area [#773](https://github.com/alibaba/lowcode-engine/issues/773) ([b4b30a3](https://github.com/alibaba/lowcode-engine/commit/b4b30a359932f5c0e8fde1b28f54a883c87901d8)) -* spec typo ([#1064](https://github.com/alibaba/lowcode-engine/issues/1064)) ([ecb9dca](https://github.com/alibaba/lowcode-engine/commit/ecb9dca2b9386ef6fadfd009d161a9203b9b9558)) -* try catch calculation of dynamic setter ([f61e2a2](https://github.com/alibaba/lowcode-engine/commit/f61e2a2b8a3d8d6754474cd392bc259917c7eb10)) -* type=legao dont make request ([98ececa](https://github.com/alibaba/lowcode-engine/commit/98ececa9c11f93e5f849b201b5b5e7ff453733d7)) -* **types:** rrror declaration of the children prop ([951d1cb](https://github.com/alibaba/lowcode-engine/commit/951d1cb103fa46c0e7926d6138657c7d10cc4f88)) -* use the original object if it is not a shell object ([5ea53f7](https://github.com/alibaba/lowcode-engine/commit/5ea53f706b6571946bcfa56b8655b55717381771)) -* use the outer documentation url of unique key, fixes [#868](https://github.com/alibaba/lowcode-engine/issues/868) ([d770007](https://github.com/alibaba/lowcode-engine/commit/d770007ff8c39e6cf527e07a7d6468dbb88c776d)) -* use the outer documentation url of unique key, fixes [#868](https://github.com/alibaba/lowcode-engine/issues/868) ([912ee22](https://github.com/alibaba/lowcode-engine/commit/912ee22180a424f63298c319c62fb481513af904)) -* use uppercase resize trigger names based on material spec ([7fda0ef](https://github.com/alibaba/lowcode-engine/commit/7fda0efe131e0e2e3141849cf3f87307e7ce1b36)) -* when designMode is not design, the hidden attribute does not take effect ([3dd0b6d](https://github.com/alibaba/lowcode-engine/commit/3dd0b6d0a86267e3029c176ff49aff793ce3e186)) - -### [1.0.4](https://github.com/alibaba/lowcode-engine/compare/@alilc/lowcode-code-generator@1.0.4-beta.0...@alilc/lowcode-code-generator@1.0.4) (2022-04-12) - +- 🐛 解决 react 中 jsx 出码的时候对于循环数据漏包 \_\_$evalArray 的问题 ([3b9b177](https://github.com/fe-lce/lowcode-engine/commit/3b9b177b052169cd0c1078cf8b488f04cb374dac)) +- 🐛 解决出码缺乏对于 i18n 数据的 params 的处理的问题 ([2cf788c](https://github.com/fe-lce/lowcode-engine/commit/2cf788c1716ae63fef20004348c59a5a65c6b3d2)), closes [#288](https://github.com/fe-lce/lowcode-engine/issues/288) +- 🐛 解决小程序环境没有 window, 而 rax 出码中却默认在 \_\_$eval 中用到 window 的问题 ([ce531ae](https://github.com/fe-lce/lowcode-engine/commit/ce531aeb457711fac92d828b431cfc3d643b3682)) +- 🐛 修复数据源引擎请求处理器映射严格模式下被过滤的问题 ([75626d8](https://github.com/fe-lce/lowcode-engine/commit/75626d877db017b8862b1d5e64d75f3af7ff667a)) +- 🐛 修正 i18n 里面的一个参数命名问题 ([20c6fca](https://github.com/fe-lce/lowcode-engine/commit/20c6fca03e99b11fa5c257cbbda0d4d23f410090)) +- 新元素无法在大纲树拖拽 ([3d41fd5](https://github.com/fe-lce/lowcode-engine/commit/3d41fd5d0783048a7cfb54c6f80d058856153d25)) +- 修复React17选中组件bug ([750d282](https://github.com/fe-lce/lowcode-engine/commit/750d282c03a880204fefdef01e180510465b82f8)) +- 修正 react 框架出码中在严格模式对 methods 和 context 的处理 ([b1a6100](https://github.com/fe-lce/lowcode-engine/commit/b1a61006bba4292790899c7c49c9c611a9384472)) +- 左侧抽屉固定模式层级不足 ([c657cee](https://github.com/fe-lce/lowcode-engine/commit/c657cee0694e3126dee89588a2aa17c4e118f786)) +- add lowcode-designer, lowcode-utils dependencies ([d250242](https://github.com/fe-lce/lowcode-engine/commit/d2502427ca988881747a35bd8da49f024939b833)) +- add support for jsx expression ([1043ef8](https://github.com/fe-lce/lowcode-engine/commit/1043ef82b1e9ceefc3b74fd21eb28e9a740bd1db)) +- addon-combine affect metadata unexpectedly ([fc5fbc6](https://github.com/fe-lce/lowcode-engine/commit/fc5fbc63a04a32bc887754f32e74c76149d74b05)) +- adjust synchronize-order of packages ([81a7304](https://github.com/fe-lce/lowcode-engine/commit/81a73049bd848524e1156761ded08ddf325863ba)) +- change typescript type export to export type ([50e4a03](https://github.com/fe-lce/lowcode-engine/commit/50e4a03b7d810131ce413cc057b43d4a726f1ebe)) +- change typescript type export to export type ([573504b](https://github.com/fe-lce/lowcode-engine/commit/573504b0e3537ca60d234ce2b2f3feedb323405e)) +- declare parameter appHelper for valid engine options ([058a842](https://github.com/fe-lce/lowcode-engine/commit/058a84226af8ca19d8c7d63599d80d0cdf70281c)) +- defaultValue should be evaluated inspite of condition result is falsy, fixes [#1045](https://github.com/fe-lce/lowcode-engine/issues/1045) ([fcfce3c](https://github.com/fe-lce/lowcode-engine/commit/fcfce3cbeb5a53600c40aea07ffef19c9c9591c4)) +- delete the defaultValue configuration outside the loop ([acf7449](https://github.com/fe-lce/lowcode-engine/commit/acf7449ca231d45e8ed7e1d9416817ea11b1266f)) +- delete unused typescript types ([63f5d2c](https://github.com/fe-lce/lowcode-engine/commit/63f5d2ca3e0bda92898fd0df28c9500707812082)) +- delete unused typescript types ([2432aed](https://github.com/fe-lce/lowcode-engine/commit/2432aed83d55407d2f8b5f94910ada7ea78bb59e)) +- designer/loadIncrementalAssets await Sequential ([#841](https://github.com/fe-lce/lowcode-engine/issues/841)) ([8232424](https://github.com/fe-lce/lowcode-engine/commit/823242469743d235923b3b946ec7d2db70887ead)) +- error thrown when triggering undo after save schema on SchemaPane ([9be46e7](https://github.com/fe-lce/lowcode-engine/commit/9be46e7b34e3a40cbc489dbae4bfd0915c2090e3)) +- fallback focusNode to root if empty ([a9a118f](https://github.com/fe-lce/lowcode-engine/commit/a9a118fe6e79080245c6eea42ed26772b7c784ca)) +- **filter:** unique key prop warning ([3fe6e41](https://github.com/fe-lce/lowcode-engine/commit/3fe6e41536cd3a9b9c7eaca5b353de4bd1f91b11)) +- **filter:** unique key prop warning ([06e6920](https://github.com/fe-lce/lowcode-engine/commit/06e6920602bdf21b6e1ffe5cfa3dfe4856e7c57e)) +- fix css resources with parameters not loading correctly ([f859752](https://github.com/fe-lce/lowcode-engine/commit/f85975211814147d40ae5330a76cb21cb6c66916)) +- fix css resources with parameters not loading correctly ([9a5a04a](https://github.com/fe-lce/lowcode-engine/commit/9a5a04ac9560fb6a51bf4e0ed8ea446381d39c35)) +- fix dataSource needs to be compatible due to empty schema ([98bc477](https://github.com/fe-lce/lowcode-engine/commit/98bc477d80dbf7993f89befdb42762d78a55fb1b)) +- fix displayName spell mistake ([2b2bcbd](https://github.com/fe-lce/lowcode-engine/commit/2b2bcbdaebde6a3ce974072f586386ef7ef3497c)) +- fix internal project.getSchema default stage is error ([0d40db2](https://github.com/fe-lce/lowcode-engine/commit/0d40db2581f4fe5a9e22f763f21aec641e366c34)) +- fix lint issues for renderer-core/renderer/base ([d85437d](https://github.com/fe-lce/lowcode-engine/commit/d85437d4af1043371e27dfde98cecf914b93a126)) +- fix lint issues for renderer-core/renderer/base ([4b59190](https://github.com/fe-lce/lowcode-engine/commit/4b59190c7f9d518bc7efac44b7eeee73f1b5d177)) +- fix low-code component rendering problems: 1. thisRequiredInJSE does not take effect 2. jsx components cannot obtain source components ([5dd4625](https://github.com/fe-lce/lowcode-engine/commit/5dd462544fbbbccfa97165f2bcfeed8629fab2a3)) +- fix material-spec demo ([438cccd](https://github.com/fe-lce/lowcode-engine/commit/438cccd58e4341638070c1d8b2d4e78e4e20e3fb)) +- fix misused doc urls ([16a8857](https://github.com/fe-lce/lowcode-engine/commit/16a88578634b9da2f04698df5ca5a5e69151bb97)) +- fix monitor utils incorrect assignment method ([bf280c6](https://github.com/fe-lce/lowcode-engine/commit/bf280c6fa1e46d084fc8f20323164816fad4076f)) +- fix outline-pane invisible occasionally when dragging tree node ([031c7f2](https://github.com/fe-lce/lowcode-engine/commit/031c7f25f10a6cfebfc7929c9226f4e4167a359f)) +- fix outline-tree initialization failed ([a2d5c6f](https://github.com/fe-lce/lowcode-engine/commit/a2d5c6fd90ca0226bbbfea01a4b28c8b8d307a78)) +- fix render module state expression initialization exception ([5bd68ee](https://github.com/fe-lce/lowcode-engine/commit/5bd68ee6b448fa58b022870b3f8175d8b77febde)) +- fix render module state expression initialization exception ([9c545cc](https://github.com/fe-lce/lowcode-engine/commit/9c545cca6004f65e2f206ea001cefa3fa3cfa807)) +- fix setter hooks error ([8a3a0b8](https://github.com/fe-lce/lowcode-engine/commit/8a3a0b824162e25a930711c6fef511b4b369e897)) +- fix test case failures of designer ([4b0521a](https://github.com/fe-lce/lowcode-engine/commit/4b0521a47494f78e120f75021e0a076fb00ce53e)) +- Fix the conversion failure of some props expressions under Slot props of low-code components ([7db5461](https://github.com/fe-lce/lowcode-engine/commit/7db5461706c739fac673b2466bc2fda7661242e4)) +- fix the leaf hoc component fails to monitor Node changes, and modify the logic for get node ([6ee6b07](https://github.com/fe-lce/lowcode-engine/commit/6ee6b07a10ba4aac583def52d8ff1fa78d111d0b)) +- fix the leaf hoc component fails to monitor Node changes, and modify the logic for get node ([f400172](https://github.com/fe-lce/lowcode-engine/commit/f4001728259047b09db75d76a8c3ef1e1bcb4e0a)) +- fix the problem that material.getComponentMetasMap returns the wrong result ([e02933c](https://github.com/fe-lce/lowcode-engine/commit/e02933c18bc15519b2eba8ad946282502a509611)) +- Fix the rendering error caused by incorrect key value when configuring the loop ([1026763](https://github.com/fe-lce/lowcode-engine/commit/1026763dc5a77d4395a1e86e5a0084ab4fb4230c)) +- fix the unit test failure problem caused by thisRequiredInJSE modification ([c2c59b7](https://github.com/fe-lce/lowcode-engine/commit/c2c59b7ff72ba06156bbcdb952262739d6188209)) +- fix unnecessary props calculation ([f1fed75](https://github.com/fe-lce/lowcode-engine/commit/f1fed75f39be8289ede1ec558b04428a69e25b5f)) +- fixed an issue where materials would be rendered multiple times ([9d187cc](https://github.com/fe-lce/lowcode-engine/commit/9d187ccb7de55857e861d3fc881c610506872d03)) +- fixed an issue where materials would be rendered multiple times ([64cc328](https://github.com/fe-lce/lowcode-engine/commit/64cc3283c15342151a8f93c46a276681f3575153)) +- fixed focusNodeSelector configuration not taking effect ([9beae9c](https://github.com/fe-lce/lowcode-engine/commit/9beae9c3269901bf03a29033121c7d480571bce5)) +- fixed the issue that thisRequiredInJSE did not take effect in some scenarios ([7e5a919](https://github.com/fe-lce/lowcode-engine/commit/7e5a919f9352397f11741fd911495996469c0256)) +- in ES require changed to import ([b4d7d6d](https://github.com/fe-lce/lowcode-engine/commit/b4d7d6d8c290a335a2c1f60731d4417b23444941)) +- in ES require changed to import ([7c8cd36](https://github.com/fe-lce/lowcode-engine/commit/7c8cd36a10a7caa61de31a15abd93ab8a97fbe08)) +- leaf should be type of ShellNode other than InnerNode ([5bb8cf5](https://github.com/fe-lce/lowcode-engine/commit/5bb8cf5d12d38d70b69fa28deb2f8aa0afa9b9b9)) +- lowcode component exec lifecycle has error ([f99a47e](https://github.com/fe-lce/lowcode-engine/commit/f99a47e502080134454795f5e361cfa4fba3f03b)) +- lowcode component leaf dont have export prop, exec leaf.export make error ([9d51dcd](https://github.com/fe-lce/lowcode-engine/commit/9d51dcdae38850be0206861f2cae74ca68805c25)) +- missing engine options config info ([a79875c](https://github.com/fe-lce/lowcode-engine/commit/a79875cf8698d3912b50526d97f6ac72e9a21fc9)) +- missing engine options config info ([9ccded0](https://github.com/fe-lce/lowcode-engine/commit/9ccded006ef44cd538abaa140250e519243bf090)) +- npm run clean error in windows ([a176e9d](https://github.com/fe-lce/lowcode-engine/commit/a176e9d245981fb5718c8d144f477202b3796be6)) +- project event listeners will not be invoked sometimes ([a0c772f](https://github.com/fe-lce/lowcode-engine/commit/a0c772fb903cf5eb9e0b811b64bbe3846d4ba8ac)) +- project.exportSchema api lack stage param & setAssets should be a async fn ([0ea76a7](https://github.com/fe-lce/lowcode-engine/commit/0ea76a746fac8ea8e7b999d42434c468c85d6372)) +- project.exportSchema should export componentsMap of all documents ([969a130](https://github.com/fe-lce/lowcode-engine/commit/969a130b373fb028f8051e96cb9d79f1de0a2a1c)) +- removed incorrectly calling childWhitelist hook logic during drag and drop ([#1141](https://github.com/fe-lce/lowcode-engine/issues/1141)) ([6576346](https://github.com/fe-lce/lowcode-engine/commit/6576346b9185bedb090be9c84129e077cf5389b3)) +- renderer not rendering correct components when loading components with loadAsyncLibrary api ([9b3b4f9](https://github.com/fe-lce/lowcode-engine/commit/9b3b4f9b0e35ef3ea2f0117f0cdb2254e15d5389)) +- should pass index param when creating a Prop instance under a list type Prop instance, fix [#780](https://github.com/fe-lce/lowcode-engine/issues/780) ([a8de3f2](https://github.com/fe-lce/lowcode-engine/commit/a8de3f299c7b26fa939d2b2ea1428143e2b5fb01)) +- simulator eclipses setting area [#773](https://github.com/fe-lce/lowcode-engine/issues/773) ([b4b30a3](https://github.com/fe-lce/lowcode-engine/commit/b4b30a359932f5c0e8fde1b28f54a883c87901d8)) +- spec typo ([#1064](https://github.com/fe-lce/lowcode-engine/issues/1064)) ([ecb9dca](https://github.com/fe-lce/lowcode-engine/commit/ecb9dca2b9386ef6fadfd009d161a9203b9b9558)) +- try catch calculation of dynamic setter ([f61e2a2](https://github.com/fe-lce/lowcode-engine/commit/f61e2a2b8a3d8d6754474cd392bc259917c7eb10)) +- type=legao dont make request ([98ececa](https://github.com/fe-lce/lowcode-engine/commit/98ececa9c11f93e5f849b201b5b5e7ff453733d7)) +- **types:** rrror declaration of the children prop ([951d1cb](https://github.com/fe-lce/lowcode-engine/commit/951d1cb103fa46c0e7926d6138657c7d10cc4f88)) +- use the original object if it is not a shell object ([5ea53f7](https://github.com/fe-lce/lowcode-engine/commit/5ea53f706b6571946bcfa56b8655b55717381771)) +- use the outer documentation url of unique key, fixes [#868](https://github.com/fe-lce/lowcode-engine/issues/868) ([d770007](https://github.com/fe-lce/lowcode-engine/commit/d770007ff8c39e6cf527e07a7d6468dbb88c776d)) +- use the outer documentation url of unique key, fixes [#868](https://github.com/fe-lce/lowcode-engine/issues/868) ([912ee22](https://github.com/fe-lce/lowcode-engine/commit/912ee22180a424f63298c319c62fb481513af904)) +- use uppercase resize trigger names based on material spec ([7fda0ef](https://github.com/fe-lce/lowcode-engine/commit/7fda0efe131e0e2e3141849cf3f87307e7ce1b36)) +- when designMode is not design, the hidden attribute does not take effect ([3dd0b6d](https://github.com/fe-lce/lowcode-engine/commit/3dd0b6d0a86267e3029c176ff49aff793ce3e186)) + +### [1.0.4](https://github.com/fe-lce/lowcode-engine/compare/@felce/lowcode-code-generator@1.0.4-beta.0...@felce/lowcode-code-generator@1.0.4) (2022-04-12) ### Bug Fixes -* 🐛 解决 react 中 jsx 出码的时候对于循环数据漏包 __$evalArray 的问题 ([eb4cc69](https://github.com/alibaba/lowcode-engine/commit/eb4cc693f5dbcae54546c569eb8fa331d074e062)) - -### [1.0.4-beta.1](https://github.com/alibaba/lowcode-engine/compare/@alilc/lowcode-code-generator@1.0.4-beta.0...@alilc/lowcode-code-generator@1.0.4-beta.1) (2022-04-11) +- 🐛 解决 react 中 jsx 出码的时候对于循环数据漏包 \_\_$evalArray 的问题 ([eb4cc69](https://github.com/fe-lce/lowcode-engine/commit/eb4cc693f5dbcae54546c569eb8fa331d074e062)) +### [1.0.4-beta.1](https://github.com/fe-lce/lowcode-engine/compare/@felce/lowcode-code-generator@1.0.4-beta.0...@felce/lowcode-code-generator@1.0.4-beta.1) (2022-04-11) ### Bug Fixes -* 🐛 解决 react 中 jsx 出码的时候对于循环数据漏包 __$evalArray 的问题 ([987f4ce](https://github.com/alibaba/lowcode-engine/commit/987f4cea54ef8a75d0b63a0268b5a20b2938b8a7)) - -### [1.0.4-beta.0](https://github.com/alibaba/lowcode-engine/compare/@alilc/lowcode-code-generator@1.0.3...@alilc/lowcode-code-generator@1.0.4-beta.0) (2022-04-10) +- 🐛 解决 react 中 jsx 出码的时候对于循环数据漏包 \_\_$evalArray 的问题 ([987f4ce](https://github.com/fe-lce/lowcode-engine/commit/987f4cea54ef8a75d0b63a0268b5a20b2938b8a7)) +### [1.0.4-beta.0](https://github.com/fe-lce/lowcode-engine/compare/@felce/lowcode-code-generator@1.0.3...@felce/lowcode-code-generator@1.0.4-beta.0) (2022-04-10) ### Features -* **material-parser:** check module before install it; fix default value issue in ts parser ([fc452f7](https://github.com/alibaba/lowcode-engine/commit/fc452f7166f02acfba6076c1a9425e6f5880b5f6)) - +- **material-parser:** check module before install it; fix default value issue in ts parser ([fc452f7](https://github.com/fe-lce/lowcode-engine/commit/fc452f7166f02acfba6076c1a9425e6f5880b5f6)) ### Bug Fixes -* 🐛 修正 i18n 里面的一个参数命名问题 ([1e9e388](https://github.com/alibaba/lowcode-engine/commit/1e9e388ce9104d76c4f6d9bc513c57e5059d7982)) -* 🐛 解决出码缺乏对于 i18n 数据的 params 的处理的问题 ([1eb9add](https://github.com/alibaba/lowcode-engine/commit/1eb9addd8df2323f9aabac87af32ac2efcd6bf22)), closes [#288](https://github.com/alibaba/lowcode-engine/issues/288) -* 🐛 解决小程序环境没有 window, 而 rax 出码中却默认在 __$eval 中用到 window 的问题 ([67dabb0](https://github.com/alibaba/lowcode-engine/commit/67dabb04beb32b6e94eb1276222e53b416e47c9d)) -* Fix the conversion failure of some props expressions under Slot props of low-code components ([7db5461](https://github.com/alibaba/lowcode-engine/commit/7db5461706c739fac673b2466bc2fda7661242e4)) -* fix unnecessary props calculation ([f1fed75](https://github.com/alibaba/lowcode-engine/commit/f1fed75f39be8289ede1ec558b04428a69e25b5f)) -* 修正 react 框架出码中在严格模式对 methods 和 context 的处理 ([79db4ac](https://github.com/alibaba/lowcode-engine/commit/79db4ac97f34f24b7f7460fb3fc67521967f8cc5)) - -### [1.0.3](https://github.com/alibaba/lowcode-engine/compare/@alilc/lowcode-code-generator@1.0.2...@alilc/lowcode-code-generator@1.0.3) (2022-03-29) +- 🐛 修正 i18n 里面的一个参数命名问题 ([1e9e388](https://github.com/fe-lce/lowcode-engine/commit/1e9e388ce9104d76c4f6d9bc513c57e5059d7982)) +- 🐛 解决出码缺乏对于 i18n 数据的 params 的处理的问题 ([1eb9add](https://github.com/fe-lce/lowcode-engine/commit/1eb9addd8df2323f9aabac87af32ac2efcd6bf22)), closes [#288](https://github.com/fe-lce/lowcode-engine/issues/288) +- 🐛 解决小程序环境没有 window, 而 rax 出码中却默认在 \_\_$eval 中用到 window 的问题 ([67dabb0](https://github.com/fe-lce/lowcode-engine/commit/67dabb04beb32b6e94eb1276222e53b416e47c9d)) +- Fix the conversion failure of some props expressions under Slot props of low-code components ([7db5461](https://github.com/fe-lce/lowcode-engine/commit/7db5461706c739fac673b2466bc2fda7661242e4)) +- fix unnecessary props calculation ([f1fed75](https://github.com/fe-lce/lowcode-engine/commit/f1fed75f39be8289ede1ec558b04428a69e25b5f)) +- 修正 react 框架出码中在严格模式对 methods 和 context 的处理 ([79db4ac](https://github.com/fe-lce/lowcode-engine/commit/79db4ac97f34f24b7f7460fb3fc67521967f8cc5)) +### [1.0.3](https://github.com/fe-lce/lowcode-engine/compare/@felce/lowcode-code-generator@1.0.2...@felce/lowcode-code-generator@1.0.3) (2022-03-29) ### Features -* add getConvertedExtraKey / getOriginalExtraKey to utils ([8e7bb9d](https://github.com/alibaba/lowcode-engine/commit/8e7bb9d4b86454dd77c6928eb769cd764cad8630)) - +- add getConvertedExtraKey / getOriginalExtraKey to utils ([8e7bb9d](https://github.com/fe-lce/lowcode-engine/commit/8e7bb9d4b86454dd77c6928eb769cd764cad8630)) ### Bug Fixes -* 🐛 出码: 解决 componentName 和 exportName 不一致时生成的 import 语句的问题 ([eefc091](https://github.com/alibaba/lowcode-engine/commit/eefc091ee7e86d6214d20d486212cb5aff237946)) -* component cannot be redisplayed by configuration after rendering is closed ([c54f369](https://github.com/alibaba/lowcode-engine/commit/c54f369e1860d818479dda9d6429f851c0b08fa6)) -* fix loop configuration auto fill empty array issue ([d087092](https://github.com/alibaba/lowcode-engine/commit/d087092fd712eff0556adacda692d3ff6f2f9f22)) -* make important true by default ([c63b6e1](https://github.com/alibaba/lowcode-engine/commit/c63b6e1bfadc3fc87ed41840952e02ffbff24fab)) -* make insertAfter & insertBefore work ([70fd372](https://github.com/alibaba/lowcode-engine/commit/70fd3720d098d6e227acb9281ee22feee66b9c0b)) -* npm源 ([437adcc](https://github.com/alibaba/lowcode-engine/commit/437adccf5f2dbb400de6e2bef10cfc4b65286f2b)) -* prop should return undefined when all items are undefined ([5bb9ec7](https://github.com/alibaba/lowcode-engine/commit/5bb9ec7a1dfaabfdb5369226b54d5f63a7999e59)) -* should not create new prop while querying fileName ([19c207d](https://github.com/alibaba/lowcode-engine/commit/19c207d29de045f473ba73baaf34e7294d40261a)) -* variable binding lost after modify the mock value ([ef95b56](https://github.com/alibaba/lowcode-engine/commit/ef95b5683273d8302bde1582de8afe3d87a808d8)) -* Workbench should receive the original skeleton other than shell skeleton ([d5c3ca1](https://github.com/alibaba/lowcode-engine/commit/d5c3ca1068ce2c2140980bd059d0da333574dc34)) - -### [1.0.2](https://github.com/alibaba/lowcode-engine/compare/@alilc/lowcode-code-generator@1.0.2-beta.1...@alilc/lowcode-code-generator@1.0.2) (2022-03-08) +- 🐛 出码: 解决 componentName 和 exportName 不一致时生成的 import 语句的问题 ([eefc091](https://github.com/fe-lce/lowcode-engine/commit/eefc091ee7e86d6214d20d486212cb5aff237946)) +- component cannot be redisplayed by configuration after rendering is closed ([c54f369](https://github.com/fe-lce/lowcode-engine/commit/c54f369e1860d818479dda9d6429f851c0b08fa6)) +- fix loop configuration auto fill empty array issue ([d087092](https://github.com/fe-lce/lowcode-engine/commit/d087092fd712eff0556adacda692d3ff6f2f9f22)) +- make important true by default ([c63b6e1](https://github.com/fe-lce/lowcode-engine/commit/c63b6e1bfadc3fc87ed41840952e02ffbff24fab)) +- make insertAfter & insertBefore work ([70fd372](https://github.com/fe-lce/lowcode-engine/commit/70fd3720d098d6e227acb9281ee22feee66b9c0b)) +- npm源 ([437adcc](https://github.com/fe-lce/lowcode-engine/commit/437adccf5f2dbb400de6e2bef10cfc4b65286f2b)) +- prop should return undefined when all items are undefined ([5bb9ec7](https://github.com/fe-lce/lowcode-engine/commit/5bb9ec7a1dfaabfdb5369226b54d5f63a7999e59)) +- should not create new prop while querying fileName ([19c207d](https://github.com/fe-lce/lowcode-engine/commit/19c207d29de045f473ba73baaf34e7294d40261a)) +- variable binding lost after modify the mock value ([ef95b56](https://github.com/fe-lce/lowcode-engine/commit/ef95b5683273d8302bde1582de8afe3d87a808d8)) +- Workbench should receive the original skeleton other than shell skeleton ([d5c3ca1](https://github.com/fe-lce/lowcode-engine/commit/d5c3ca1068ce2c2140980bd059d0da333574dc34)) -### [1.0.2-beta.1](https://github.com/alibaba/lowcode-engine/compare/@alilc/lowcode-code-generator@1.0.2-beta.0...@alilc/lowcode-code-generator@1.0.2-beta.1) (2022-03-08) +### [1.0.2](https://github.com/fe-lce/lowcode-engine/compare/@felce/lowcode-code-generator@1.0.2-beta.1...@felce/lowcode-code-generator@1.0.2) (2022-03-08) +### [1.0.2-beta.1](https://github.com/fe-lce/lowcode-engine/compare/@felce/lowcode-code-generator@1.0.2-beta.0...@felce/lowcode-code-generator@1.0.2-beta.1) (2022-03-08) ### Bug Fixes -* 🐛 补充 icejs 模板中缺失的依赖包 ([a94553e](https://github.com/alibaba/lowcode-engine/commit/a94553e503d439b67478df6a34950d9e3d15a063)) - -### [1.0.2-beta.0](https://github.com/alibaba/lowcode-engine/compare/@alilc/lowcode-code-generator@1.0.0...@alilc/lowcode-code-generator@1.0.2-beta.0) (2022-03-08) +- 🐛 补充 icejs 模板中缺失的依赖包 ([a94553e](https://github.com/fe-lce/lowcode-engine/commit/a94553e503d439b67478df6a34950d9e3d15a063)) +### [1.0.2-beta.0](https://github.com/fe-lce/lowcode-engine/compare/@felce/lowcode-code-generator@1.0.0...@felce/lowcode-code-generator@1.0.2-beta.0) (2022-03-08) ### Features -* 在 skeleton 增加几个方法和事件 ([a7d436a](https://github.com/alibaba/lowcode-engine/commit/a7d436a0525a0ce0c7229710077111f283b452f4)) -* modify npm private control & version ([ee55d02](https://github.com/alibaba/lowcode-engine/commit/ee55d024a7f964ccf35a0efabec817364cea8041)) -* modify yuque link in README ([d522034](https://github.com/alibaba/lowcode-engine/commit/d522034879d20a7b5ed12f8fe02a30662a2ea7c6)) -* remove CHANGELOG.md ([b996414](https://github.com/alibaba/lowcode-engine/commit/b996414c436b5d2439c8368eb4e001cdbcd02892)) -* remove module field in material-parser package.json ([6141c27](https://github.com/alibaba/lowcode-engine/commit/6141c273c9c32eea22b5374679fe625e6ea15394)) -* rename build:umd ([23c7959](https://github.com/alibaba/lowcode-engine/commit/23c795931e1d5cf43e9c21cd902441c69c1ecc63)) -* replace tnpm with npm ([36caf0f](https://github.com/alibaba/lowcode-engine/commit/36caf0f18980c16f7ebb82ac845ad6b33e033567)) -* support UMD packageing for react-renderer ([982d0d6](https://github.com/alibaba/lowcode-engine/commit/982d0d676b3dfbfc10a2190c0040126d6925ed37)) - +- 在 skeleton 增加几个方法和事件 ([a7d436a](https://github.com/fe-lce/lowcode-engine/commit/a7d436a0525a0ce0c7229710077111f283b452f4)) +- modify npm private control & version ([ee55d02](https://github.com/fe-lce/lowcode-engine/commit/ee55d024a7f964ccf35a0efabec817364cea8041)) +- modify yuque link in README ([d522034](https://github.com/fe-lce/lowcode-engine/commit/d522034879d20a7b5ed12f8fe02a30662a2ea7c6)) +- remove CHANGELOG.md ([b996414](https://github.com/fe-lce/lowcode-engine/commit/b996414c436b5d2439c8368eb4e001cdbcd02892)) +- remove module field in material-parser package.json ([6141c27](https://github.com/fe-lce/lowcode-engine/commit/6141c273c9c32eea22b5374679fe625e6ea15394)) +- rename build:umd ([23c7959](https://github.com/fe-lce/lowcode-engine/commit/23c795931e1d5cf43e9c21cd902441c69c1ecc63)) +- replace tnpm with npm ([36caf0f](https://github.com/fe-lce/lowcode-engine/commit/36caf0f18980c16f7ebb82ac845ad6b33e033567)) +- support UMD packageing for react-renderer ([982d0d6](https://github.com/fe-lce/lowcode-engine/commit/982d0d676b3dfbfc10a2190c0040126d6925ed37)) ### Bug Fixes -* 🐛 去掉 npm 上没有的依赖 ([#68](https://github.com/alibaba/lowcode-engine/issues/68)) ([e7ce779](https://github.com/alibaba/lowcode-engine/commit/e7ce77987eb05871dd1675d2a88367c5569bfbff)) -* 兼容 setters 为空的情况 ([56b459a](https://github.com/alibaba/lowcode-engine/commit/56b459a017a8350a911ef20f0166d1e62b6390e4)) -* 解决 package.json 中误添加了没有用到的数据源类型的 handler 的包的问题 ([#56](https://github.com/alibaba/lowcode-engine/issues/56)) ([76341c8](https://github.com/alibaba/lowcode-engine/commit/76341c8456b227192bb65537dc3d16033db0b3a1)) -* 解决出码的一些问题 ([#87](https://github.com/alibaba/lowcode-engine/issues/87)) ([4a01c97](https://github.com/alibaba/lowcode-engine/commit/4a01c97ea6bf23eb677888ba1aba54e5c9f4f630)) -* 修复 setup 的逻辑 ([1cfb15a](https://github.com/alibaba/lowcode-engine/commit/1cfb15aebea9796af23b2135f2aa4409d81283d7)) -* 修正一些对内的地址 ([07cc1f2](https://github.com/alibaba/lowcode-engine/commit/07cc1f2954530c64a1a3d260e8d532c9e19892e8)) -* 增加必要的方法 ([1b38a81](https://github.com/alibaba/lowcode-engine/commit/1b38a812653656aa02100a3b1b2a581188d1b3ef)) -* fix tsconfig of material-parser ([46725cb](https://github.com/alibaba/lowcode-engine/commit/46725cb9f3166912c8f5b42f1e0b1177158c1ee3)) -* lint&fix auto generated types.ts ([7dde970](https://github.com/alibaba/lowcode-engine/commit/7dde9701c7960b29523abddf32421cdbac47016d)) -* The outline tree does not display the loop flag when the loop is an empty array ([191e284](https://github.com/alibaba/lowcode-engine/commit/191e284f2fa190c2b3aecb4df31849b2bdc99d38)) - -### [1.0.1](https://github.com/alibaba/lowcode-engine/compare/@alilc/lowcode-code-generator@1.0.0...@alilc/lowcode-code-generator@1.0.1) (2022-03-08) +- 🐛 去掉 npm 上没有的依赖 ([#68](https://github.com/fe-lce/lowcode-engine/issues/68)) ([e7ce779](https://github.com/fe-lce/lowcode-engine/commit/e7ce77987eb05871dd1675d2a88367c5569bfbff)) +- 兼容 setters 为空的情况 ([56b459a](https://github.com/fe-lce/lowcode-engine/commit/56b459a017a8350a911ef20f0166d1e62b6390e4)) +- 解决 package.json 中误添加了没有用到的数据源类型的 handler 的包的问题 ([#56](https://github.com/fe-lce/lowcode-engine/issues/56)) ([76341c8](https://github.com/fe-lce/lowcode-engine/commit/76341c8456b227192bb65537dc3d16033db0b3a1)) +- 解决出码的一些问题 ([#87](https://github.com/fe-lce/lowcode-engine/issues/87)) ([4a01c97](https://github.com/fe-lce/lowcode-engine/commit/4a01c97ea6bf23eb677888ba1aba54e5c9f4f630)) +- 修复 setup 的逻辑 ([1cfb15a](https://github.com/fe-lce/lowcode-engine/commit/1cfb15aebea9796af23b2135f2aa4409d81283d7)) +- 修正一些对内的地址 ([07cc1f2](https://github.com/fe-lce/lowcode-engine/commit/07cc1f2954530c64a1a3d260e8d532c9e19892e8)) +- 增加必要的方法 ([1b38a81](https://github.com/fe-lce/lowcode-engine/commit/1b38a812653656aa02100a3b1b2a581188d1b3ef)) +- fix tsconfig of material-parser ([46725cb](https://github.com/fe-lce/lowcode-engine/commit/46725cb9f3166912c8f5b42f1e0b1177158c1ee3)) +- lint&fix auto generated types.ts ([7dde970](https://github.com/fe-lce/lowcode-engine/commit/7dde9701c7960b29523abddf32421cdbac47016d)) +- The outline tree does not display the loop flag when the loop is an empty array ([191e284](https://github.com/fe-lce/lowcode-engine/commit/191e284f2fa190c2b3aecb4df31849b2bdc99d38)) +### [1.0.1](https://github.com/fe-lce/lowcode-engine/compare/@felce/lowcode-code-generator@1.0.0...@felce/lowcode-code-generator@1.0.1) (2022-03-08) ### Features -* 在 skeleton 增加几个方法和事件 ([a7d436a](https://github.com/alibaba/lowcode-engine/commit/a7d436a0525a0ce0c7229710077111f283b452f4)) -* modify npm private control & version ([ee55d02](https://github.com/alibaba/lowcode-engine/commit/ee55d024a7f964ccf35a0efabec817364cea8041)) -* modify yuque link in README ([d522034](https://github.com/alibaba/lowcode-engine/commit/d522034879d20a7b5ed12f8fe02a30662a2ea7c6)) -* remove CHANGELOG.md ([b996414](https://github.com/alibaba/lowcode-engine/commit/b996414c436b5d2439c8368eb4e001cdbcd02892)) -* remove module field in material-parser package.json ([6141c27](https://github.com/alibaba/lowcode-engine/commit/6141c273c9c32eea22b5374679fe625e6ea15394)) -* rename build:umd ([23c7959](https://github.com/alibaba/lowcode-engine/commit/23c795931e1d5cf43e9c21cd902441c69c1ecc63)) -* replace tnpm with npm ([36caf0f](https://github.com/alibaba/lowcode-engine/commit/36caf0f18980c16f7ebb82ac845ad6b33e033567)) -* support UMD packageing for react-renderer ([982d0d6](https://github.com/alibaba/lowcode-engine/commit/982d0d676b3dfbfc10a2190c0040126d6925ed37)) - +- 在 skeleton 增加几个方法和事件 ([a7d436a](https://github.com/fe-lce/lowcode-engine/commit/a7d436a0525a0ce0c7229710077111f283b452f4)) +- modify npm private control & version ([ee55d02](https://github.com/fe-lce/lowcode-engine/commit/ee55d024a7f964ccf35a0efabec817364cea8041)) +- modify yuque link in README ([d522034](https://github.com/fe-lce/lowcode-engine/commit/d522034879d20a7b5ed12f8fe02a30662a2ea7c6)) +- remove CHANGELOG.md ([b996414](https://github.com/fe-lce/lowcode-engine/commit/b996414c436b5d2439c8368eb4e001cdbcd02892)) +- remove module field in material-parser package.json ([6141c27](https://github.com/fe-lce/lowcode-engine/commit/6141c273c9c32eea22b5374679fe625e6ea15394)) +- rename build:umd ([23c7959](https://github.com/fe-lce/lowcode-engine/commit/23c795931e1d5cf43e9c21cd902441c69c1ecc63)) +- replace tnpm with npm ([36caf0f](https://github.com/fe-lce/lowcode-engine/commit/36caf0f18980c16f7ebb82ac845ad6b33e033567)) +- support UMD packageing for react-renderer ([982d0d6](https://github.com/fe-lce/lowcode-engine/commit/982d0d676b3dfbfc10a2190c0040126d6925ed37)) ### Bug Fixes -* 🐛 修正一些示例地址 ([8d21283](https://github.com/alibaba/lowcode-engine/commit/8d212832e77a1ec763db668683917705774acd0d)) -* 兼容 setters 为空的情况 ([56b459a](https://github.com/alibaba/lowcode-engine/commit/56b459a017a8350a911ef20f0166d1e62b6390e4)) -* 修复 setup 的逻辑 ([1cfb15a](https://github.com/alibaba/lowcode-engine/commit/1cfb15aebea9796af23b2135f2aa4409d81283d7)) -* 修正一些对内的地址 ([07cc1f2](https://github.com/alibaba/lowcode-engine/commit/07cc1f2954530c64a1a3d260e8d532c9e19892e8)) -* 增加必要的方法 ([1b38a81](https://github.com/alibaba/lowcode-engine/commit/1b38a812653656aa02100a3b1b2a581188d1b3ef)) -* fix tsconfig of material-parser ([46725cb](https://github.com/alibaba/lowcode-engine/commit/46725cb9f3166912c8f5b42f1e0b1177158c1ee3)) -* lint&fix auto generated types.ts ([7dde970](https://github.com/alibaba/lowcode-engine/commit/7dde9701c7960b29523abddf32421cdbac47016d)) -* The outline tree does not display the loop flag when the loop is an empty array ([191e284](https://github.com/alibaba/lowcode-engine/commit/191e284f2fa190c2b3aecb4df31849b2bdc99d38)) +- 🐛 修正一些示例地址 ([8d21283](https://github.com/fe-lce/lowcode-engine/commit/8d212832e77a1ec763db668683917705774acd0d)) +- 兼容 setters 为空的情况 ([56b459a](https://github.com/fe-lce/lowcode-engine/commit/56b459a017a8350a911ef20f0166d1e62b6390e4)) +- 修复 setup 的逻辑 ([1cfb15a](https://github.com/fe-lce/lowcode-engine/commit/1cfb15aebea9796af23b2135f2aa4409d81283d7)) +- 修正一些对内的地址 ([07cc1f2](https://github.com/fe-lce/lowcode-engine/commit/07cc1f2954530c64a1a3d260e8d532c9e19892e8)) +- 增加必要的方法 ([1b38a81](https://github.com/fe-lce/lowcode-engine/commit/1b38a812653656aa02100a3b1b2a581188d1b3ef)) +- fix tsconfig of material-parser ([46725cb](https://github.com/fe-lce/lowcode-engine/commit/46725cb9f3166912c8f5b42f1e0b1177158c1ee3)) +- lint&fix auto generated types.ts ([7dde970](https://github.com/fe-lce/lowcode-engine/commit/7dde9701c7960b29523abddf32421cdbac47016d)) +- The outline tree does not display the loop flag when the loop is an empty array ([191e284](https://github.com/fe-lce/lowcode-engine/commit/191e284f2fa190c2b3aecb4df31849b2bdc99d38)) ## 1.0.0 (2022-02-17) - ### Features -* first commit - genesis ([4f4ac51](https://github.com/alibaba/lowcode-engine/commit/4f4ac5115d18357a7399632860808f6cffc33fad)) +- first commit - genesis ([4f4ac51](https://github.com/fe-lce/lowcode-engine/commit/4f4ac5115d18357a7399632860808f6cffc33fad)) diff --git a/modules/code-generator/CONTRIBUTING.md b/modules/code-generator/CONTRIBUTING.md index 5f4d373b80..5950d40025 100644 --- a/modules/code-generator/CONTRIBUTING.md +++ b/modules/code-generator/CONTRIBUTING.md @@ -1,7 +1,7 @@ # 如何共建 1. 拉取最新代码,切换到 develop 分支,基于 develop 分支切出一个 feature 或 hotfix 分支 -2. 到 `lowcode-engine` 项目根目录下,执行 `lerna bootstrap && lerna run build --scope "@alilc/lowcode-types"` 来安装依赖并构建 +2. 到 `lowcode-engine` 项目根目录下,执行 `lerna bootstrap && lerna run build --scope "@felce/lowcode-types"` 来安装依赖并构建 3. 到 `lowcode-engine/modules/code-generator`下,安装依赖(`npm i`),然后先跑一遍 `npm test` 看看是否所有用例都能通过 (如果网络条件不太好,建议使用 [cnpm - 淘宝提供的中国 NPM 镜像](https://npmmirror.com/)) 4. 在 tests 目录下编写您的需求/问题的测试用例 5. 修改 src 下的一些代码,然后运行 `npm test` 或 `npm start` 启动 jest 进行调测 diff --git a/modules/code-generator/README.md b/modules/code-generator/README.md index 1d67b3aa16..cf61fba9ce 100644 --- a/modules/code-generator/README.md +++ b/modules/code-generator/README.md @@ -6,9 +6,9 @@ ### 1) 通过命令行快速体验 -欢迎使用命令行工具快速体验:`npx @alilc/lowcode-code-generator -i example-schema.json -o generated -s icejs` +欢迎使用命令行工具快速体验:`npx @felce/lowcode-code-generator -i example-schema.json -o generated -s icejs` ---其中 example-schema.json 可以从[这里下载](https://unpkg.com/@alilc/lowcode-code-generator@beta/example-schema.json) +--其中 example-schema.json 可以从[这里下载](https://unpkg.com/@felce/lowcode-code-generator@beta/example-schema.json) ### 2) 通过设计器插件快速体验 @@ -16,7 +16,7 @@ 2. 注册插件: ```ts -import { plugins } from '@alilc/lowcode-engine'; +import { plugins } from '@felce/lowcode-engine'; import CodeGenPlugin from '@alilc/lowcode-plugin-code-generator'; // 在你的初始化函数中: @@ -32,11 +32,11 @@ await plugins.register(CodeGenPlugin, { disableCodeGenActionBtn: true }); 此代码生成器一开始就是为服务端出码设计的,你可以直接这样来在 node.js 环境中使用: -1. 安装依赖: `npm install --save @alilc/lowcode-code-generator` +1. 安装依赖: `npm install --save @felce/lowcode-code-generator` 2. 引入代码生成器: ```js -import CodeGenerator from '@alilc/lowcode-code-generator'; +import CodeGenerator from '@felce/lowcode-code-generator'; ``` 3. 创建项目构建器: @@ -77,11 +77,11 @@ await CodeGenerator.publishers.zip().publish({ 随着现在电脑性能和浏览器技术的发展,出码其实已经不必非得在服务端做了,借助于 Web Worker 特性,可以在浏览器中进行出码: -1. 安装依赖: `npm install --save @alilc/lowcode-code-generator` +1. 安装依赖: `npm install --save @felce/lowcode-code-generator` 2. 引入代码生成器: ```js -import * as CodeGenerator from '@alilc/lowcode-code-generator/standalone-loader'; +import * as CodeGenerator from '@felce/lowcode-code-generator/standalone-loader'; ``` 3. 【可选】提前初始化代码生成器: @@ -120,4 +120,4 @@ await CodeGenerator.publishers.zip().publish({ ## 参与共建 -欢迎参与共建,如何共建请参阅:[./CONTRIBUTING.md](https://github.com/alibaba/lowcode-engine/blob/main/modules/code-generator/CONTRIBUTING.md) +欢迎参与共建,如何共建请参阅:[./CONTRIBUTING.md](https://github.com/fe-lce/lowcode-engine/blob/main/modules/code-generator/CONTRIBUTING.md) diff --git a/modules/code-generator/package.json b/modules/code-generator/package.json index cd114fa067..48f7c423aa 100644 --- a/modules/code-generator/package.json +++ b/modules/code-generator/package.json @@ -1,5 +1,5 @@ { - "name": "@alilc/lowcode-code-generator", + "name": "@felce/lowcode-code-generator", "version": "1.1.7", "description": "出码引擎 for LowCode Engine", "license": "MIT", @@ -41,9 +41,9 @@ "test:cov": "jest --coverage", "test:update-snapshots": "cross-env UPDATE_EXPECTED=true jest -u", "analyze:standalone": "ANALYZE=true node scripts/build-standalone", - "release:beta": "standard-version -t @alilc/lowcode-code-generator\\@ -r patch --prerelease beta && git push --follow-tags && npm publish --tag beta", - "release:patch": "standard-version -t @alilc/lowcode-code-generator\\@ -r patch && git push --follow-tags && npm publish", - "release:minor": "standard-version -t @alilc/lowcode-code-generator\\@ -r minor && git push --follow-tags && npm publish", + "release:beta": "standard-version -t @felce/lowcode-code-generator\\@ -r patch --prerelease beta && git push --follow-tags && npm publish --tag beta", + "release:patch": "standard-version -t @felce/lowcode-code-generator\\@ -r patch && git push --follow-tags && npm publish", + "release:minor": "standard-version -t @felce/lowcode-code-generator\\@ -r minor && git push --follow-tags && npm publish", "prepublishOnly": "npm run build", "demo": "node bin/lowcode-code-generator.js -i example-schema.json -o demo -s icejs" }, @@ -62,7 +62,7 @@ "**/*.{js,jsx,ts,tsx}": "eslint" }, "dependencies": { - "@alilc/lowcode-types": "^1.0.0", + "@felce/lowcode-types": "^1.0.0", "@babel/generator": "^7.12.11", "@babel/parser": "^7.12.11", "@babel/runtime": "^7.12.5", @@ -148,8 +148,8 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/modules/code-generator" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/modules/code-generator" }, - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/modules/code-generator/scripts/build-cli.js b/modules/code-generator/scripts/build-cli.js index 394f87f6e9..40fcb731a6 100644 --- a/modules/code-generator/scripts/build-cli.js +++ b/modules/code-generator/scripts/build-cli.js @@ -18,7 +18,7 @@ const ignorePlugin = require('esbuild-plugin-ignore'); sourcesContent: true, plugins: [ ignorePlugin([ - // @alilc/lowcode-types 中误依赖了 react,这里忽略下 + // @felce/lowcode-types 中误依赖了 react,这里忽略下 { resourceRegExp: /^react$/, contextRegExp: /./, diff --git a/modules/code-generator/scripts/build-standalone-worker.js b/modules/code-generator/scripts/build-standalone-worker.js index c5f87395bc..3134566b24 100644 --- a/modules/code-generator/scripts/build-standalone-worker.js +++ b/modules/code-generator/scripts/build-standalone-worker.js @@ -22,7 +22,7 @@ const buildConfig = { resourceRegExp: /^fs$/, contextRegExp: /./, }, - // @alilc/lowcode-types 中误依赖了 react,这里忽略下 + // @felce/lowcode-types 中误依赖了 react,这里忽略下 { resourceRegExp: /^react$/, contextRegExp: /./, diff --git a/modules/code-generator/scripts/build-standalone.js b/modules/code-generator/scripts/build-standalone.js index 3b101f5ac0..804a7754db 100644 --- a/modules/code-generator/scripts/build-standalone.js +++ b/modules/code-generator/scripts/build-standalone.js @@ -24,7 +24,7 @@ const buildConfig = { resourceRegExp: /^fs$/, contextRegExp: /./, }, - // @alilc/lowcode-types 中误依赖了 react,这里忽略下 + // @felce/lowcode-types 中误依赖了 react,这里忽略下 { resourceRegExp: /^react$/, contextRegExp: /./, diff --git a/modules/code-generator/scripts/build-template-static-files.js b/modules/code-generator/scripts/build-template-static-files.js index 4daad4360d..c802498a06 100644 --- a/modules/code-generator/scripts/build-template-static-files.js +++ b/modules/code-generator/scripts/build-template-static-files.js @@ -68,7 +68,7 @@ function buildTemplateStaticFiles({ sourceDir, outputDir }) { PROJECT_ROOT, path.join(sourceDir, sourceFileName), )}" and run "npm run template" */`, - `import { ResultFile } from '@alilc/lowcode-types';`, + `import { ResultFile } from '@felce/lowcode-types';`, '', `export default function getFile(): [string[], ResultFile] {`, ` return ${JSON5.stringify([ @@ -99,7 +99,7 @@ function buildTemplateStaticFiles({ sourceDir, outputDir }) { path.join(outputDir, 'static-files.ts'), [ `/* Note: this file is generated by "npm run template", please dont modify this file directly */`, - `import { ResultDir } from '@alilc/lowcode-types'; + `import { ResultDir } from '@felce/lowcode-types'; import { createResultDir } from '../../../../../utils/resultHelper'; import { runFileGenerator } from '../../../../../utils/templateHelper';`, diff --git a/modules/code-generator/src/analyzer/componentAnalyzer.ts b/modules/code-generator/src/analyzer/componentAnalyzer.ts index 69e8ad482d..8a504aeec7 100644 --- a/modules/code-generator/src/analyzer/componentAnalyzer.ts +++ b/modules/code-generator/src/analyzer/componentAnalyzer.ts @@ -1,4 +1,4 @@ -import type { IPublicTypeNodeSchema, IPublicTypeCompositeObject } from '@alilc/lowcode-types'; +import type { IPublicTypeNodeSchema, IPublicTypeCompositeObject } from '@felce/lowcode-types'; import type { TComponentAnalyzer } from '../types'; import { handleSubNodes } from '../utils/schema'; diff --git a/modules/code-generator/src/cli/run.ts b/modules/code-generator/src/cli/run.ts index ec6814f767..304f5ea9aa 100644 --- a/modules/code-generator/src/cli/run.ts +++ b/modules/code-generator/src/cli/run.ts @@ -9,7 +9,7 @@ import * as path from 'path'; import { getErrorMessage } from '../utils/errors'; import CodeGenerator from '..'; import type { IProjectBuilder } from '..'; -import type { IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import type { IPublicTypeProjectSchema } from '@felce/lowcode-types'; /** * 执行出码 CLI 命令 @@ -48,13 +48,10 @@ export async function run( try { solutionOptions = JSON.parse(options.solutionOptions); } catch (err: any) { - throw new Error( - `solution options parse error, error message is "${err.message}"`, - ); + throw new Error(`solution options parse error, error message is "${err.message}"`); } } - // 读取 Schema const schema = await loadSchemaFile(schemaFile); @@ -89,7 +86,7 @@ export async function run( async function getProjectBuilderFactory( solution: string, { quiet }: { quiet?: boolean }, -): Promise<(options: {[prop: string]: any}) => IProjectBuilder> { +): Promise<(options: { [prop: string]: any }) => IProjectBuilder> { if (solution in CodeGenerator.solutions) { return CodeGenerator.solutions[solution as 'icejs' | 'rax']; } @@ -109,9 +106,11 @@ async function getProjectBuilderFactory( } // eslint-disable-next-line @typescript-eslint/no-require-imports - const solutionExports = require(!isLocalSolution(solution) - ? solutionPackageName - : `${path.isAbsolute(solution) ? solution : path.join(process.cwd(), solution)}`); + const solutionExports = require( + !isLocalSolution(solution) + ? solutionPackageName + : `${path.isAbsolute(solution) ? solution : path.join(process.cwd(), solution)}`, + ); const projectBuilderFactory = solutionExports.createProjectBuilder || diff --git a/modules/code-generator/src/cli/solutions/example-solution.ts b/modules/code-generator/src/cli/solutions/example-solution.ts index bfb9d079b1..6c779292fe 100644 --- a/modules/code-generator/src/cli/solutions/example-solution.ts +++ b/modules/code-generator/src/cli/solutions/example-solution.ts @@ -547,7 +547,7 @@ codealike.json "test": "jest", "test:watch": "jest --watch", "test:update-snapshots": "cross-env UPDATE_EXPECTED=true npx jest", - "demo": "npm run build && npx @alilc/lowcode-code-generator --solution . --output generated demo-schema.json" + "demo": "npm run build && npx @felce/lowcode-code-generator --solution . --output generated demo-schema.json" }, "repository": { "type": "git", @@ -559,8 +559,8 @@ codealike.json "registry": "https://registry.npm.xxx.com" }, "dependencies": { - "@alilc/lowcode-code-generator": "^1.0.0", - "@alilc/lowcode-types": "^1.0.0", + "@felce/lowcode-code-generator": "^1.0.0", + "@felce/lowcode-types": "^1.0.0", "tslib": "^2.3.0" }, "devDependencies": { @@ -626,7 +626,7 @@ codealike.json }, { file: 'src/index.ts', - content: `import CodeGen from '@alilc/lowcode-code-generator'; + content: `import CodeGen from '@felce/lowcode-code-generator'; import examplePlugin from './plugins/example'; @@ -714,7 +714,7 @@ export default function createHelloWorldProjectBuilder() { COMMON_CHUNK_NAME, CLASS_DEFINE_CHUNK_NAME, DEFAULT_LINK_AFTER, -} from '@alilc/lowcode-code-generator'; +} from '@felce/lowcode-code-generator'; export interface PluginConfig { fileType: string; diff --git a/modules/code-generator/src/generator/ModuleBuilder.ts b/modules/code-generator/src/generator/ModuleBuilder.ts index e172f716e5..d0fc943758 100644 --- a/modules/code-generator/src/generator/ModuleBuilder.ts +++ b/modules/code-generator/src/generator/ModuleBuilder.ts @@ -1,4 +1,4 @@ -import { IPublicTypeProjectSchema, ResultFile, ResultDir } from '@alilc/lowcode-types'; +import { IPublicTypeProjectSchema, ResultFile, ResultDir } from '@felce/lowcode-types'; import { BuilderComponentPlugin, @@ -76,7 +76,9 @@ export function createModuleBuilder( }; }; - const generateModuleCode = async (schema: IPublicTypeProjectSchema | string): Promise => { + const generateModuleCode = async ( + schema: IPublicTypeProjectSchema | string, + ): Promise => { // Init const schemaParser: ISchemaParser = new SchemaParser(); const parseResult: IParseResult = schemaParser.parse(schema); diff --git a/modules/code-generator/src/generator/ProjectBuilder.ts b/modules/code-generator/src/generator/ProjectBuilder.ts index a910b49002..4e6d57e151 100644 --- a/modules/code-generator/src/generator/ProjectBuilder.ts +++ b/modules/code-generator/src/generator/ProjectBuilder.ts @@ -1,4 +1,4 @@ -import { ResultDir, ResultFile, IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import { ResultDir, ResultFile, IPublicTypeProjectSchema } from '@felce/lowcode-types'; import { IModuleBuilder, @@ -25,7 +25,6 @@ interface IModuleInfo { } export interface ProjectBuilderInitOptions { - /** 项目模板 */ template: IProjectTemplate; @@ -305,8 +304,9 @@ export class ProjectBuilder implements IProjectBuilder { return finalResult; } - private createModuleBuilders(extraContextData: Record = {}): - Record { + private createModuleBuilders( + extraContextData: Record = {}, + ): Record { const builders: Record = {}; Object.keys(this.plugins).forEach((pluginName) => { diff --git a/modules/code-generator/src/parser/SchemaParser.ts b/modules/code-generator/src/parser/SchemaParser.ts index b4f7424ce5..83dfc9838b 100644 --- a/modules/code-generator/src/parser/SchemaParser.ts +++ b/modules/code-generator/src/parser/SchemaParser.ts @@ -12,7 +12,7 @@ import { IPublicTypePropsMap, IPublicTypeNodeData, IPublicTypeNpmInfo, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { IPageMeta, CodeGeneratorError, @@ -108,7 +108,7 @@ function processChildren(schema: IPublicTypeNodeSchema): void { function getInternalDep(internalDeps: Record, depName: string) { const dep = internalDeps[depName]; - return (dep && dep.type !== InternalDependencyType.PAGE) ? dep : null; + return dep && dep.type !== InternalDependencyType.PAGE ? dep : null; } export class SchemaParser implements ISchemaParser { @@ -145,7 +145,8 @@ export class SchemaParser implements ISchemaParser { let containers: IContainerInfo[]; // Test if this is a lowcode component without container if (schema.componentsTree.length > 0) { - const firstRoot: IPublicTypeContainerSchema = schema.componentsTree[0] as IPublicTypeContainerSchema; + const firstRoot: IPublicTypeContainerSchema = schema + .componentsTree[0] as IPublicTypeContainerSchema; if (!firstRoot.fileName && !isValidContainerType(firstRoot)) { // 整个 schema 描述一个容器,且无根节点定义 @@ -166,8 +167,11 @@ export class SchemaParser implements ISchemaParser { ...subRoot, componentName: getRootComponentName(subRoot.componentName, compDeps), containerType: subRoot.componentName, - moduleName: ensureValidClassName(subRoot.componentName === ContainerType.Component ? - subRoot.fileName : changeCase.pascalCase(subRoot.fileName)), + moduleName: ensureValidClassName( + subRoot.componentName === ContainerType.Component + ? subRoot.fileName + : changeCase.pascalCase(subRoot.fileName), + ), }; return container; }); @@ -265,7 +269,8 @@ export class SchemaParser implements ISchemaParser { utils = schema.utils; utilsDeps = schema.utils .filter( - (u): u is { name: string; type: 'npm' | 'tnpm'; content: IPublicTypeNpmInfo } => u.type !== 'function', + (u): u is { name: string; type: 'npm' | 'tnpm'; content: IPublicTypeNpmInfo } => + u.type !== 'function', ) .map( (u): IExternalDependency => ({ diff --git a/modules/code-generator/src/plugins/component/rax/containerInjectDataSourceEngine.ts b/modules/code-generator/src/plugins/component/rax/containerInjectDataSourceEngine.ts index cb7a9e8c36..930a279e24 100644 --- a/modules/code-generator/src/plugins/component/rax/containerInjectDataSourceEngine.ts +++ b/modules/code-generator/src/plugins/component/rax/containerInjectDataSourceEngine.ts @@ -6,7 +6,7 @@ import { InterpretDataSourceConfig, isJSExpression, isJSFunction, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import changeCase from 'change-case'; import { CLASS_DEFINE_CHUNK_NAME, COMMON_CHUNK_NAME } from '../../../const/generator'; @@ -152,7 +152,7 @@ _defineDataSourceConfig() { ...item, isInit: typeof item.isInit === 'boolean' || typeof item.isInit === 'undefined' - ? item.isInit ?? true + ? (item.isInit ?? true) : wrapAsFunction(item.isInit, scope), options: wrapAsFunction(item.options, scope), })), @@ -178,7 +178,10 @@ _defineDataSourceConfig() { export default pluginFactory; -function wrapAsFunction(value: IPublicTypeCompositeValue, scope: IScope): IPublicTypeCompositeValue { +function wrapAsFunction( + value: IPublicTypeCompositeValue, + scope: IScope, +): IPublicTypeCompositeValue { if (isJSExpression(value) || isJSFunction(value)) { return { type: 'JSExpression', diff --git a/modules/code-generator/src/plugins/component/rax/containerLifeCycle.ts b/modules/code-generator/src/plugins/component/rax/containerLifeCycle.ts index bbee6367f2..5db72248a8 100644 --- a/modules/code-generator/src/plugins/component/rax/containerLifeCycle.ts +++ b/modules/code-generator/src/plugins/component/rax/containerLifeCycle.ts @@ -1,5 +1,5 @@ import _ from 'lodash'; -import { isJSExpression, isJSFunction } from '@alilc/lowcode-types'; +import { isJSExpression, isJSFunction } from '@felce/lowcode-types'; import { CLASS_DEFINE_CHUNK_NAME } from '../../../const/generator'; import { RAX_CHUNK_NAME } from './const'; diff --git a/modules/code-generator/src/plugins/component/rax/jsx.ts b/modules/code-generator/src/plugins/component/rax/jsx.ts index ddae619cd6..9b10669e6b 100644 --- a/modules/code-generator/src/plugins/component/rax/jsx.ts +++ b/modules/code-generator/src/plugins/component/rax/jsx.ts @@ -4,7 +4,7 @@ import { IPublicTypeNpmInfo, IPublicTypeCompositeValue, isJSExpression, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import _ from 'lodash'; import changeCase from 'change-case'; @@ -75,7 +75,8 @@ const pluginFactory: BuilderComponentPluginFactory = (config?) => // 注意:这里其实隐含了一个假设:schema 中的 componentName 应该是一个有效的 JS 标识符,而且是大写字母打头的 // FIXME: 为了快速修复临时加的逻辑,需要用 pre-process 的方式替代处理。 - const mapComponentNameToAliasOrKeepIt = (componentName: string) => componentsNameAliasMap.get(componentName) || componentName; + const mapComponentNameToAliasOrKeepIt = (componentName: string) => + componentsNameAliasMap.get(componentName) || componentName; // 然后过滤掉所有的别名 chunks next.chunks = next.chunks.filter((chunk) => !isImportAliasDefineChunk(chunk)); diff --git a/modules/code-generator/src/plugins/component/react/containerInjectDataSourceEngine.ts b/modules/code-generator/src/plugins/component/react/containerInjectDataSourceEngine.ts index c4385017b8..ac7aa72ae2 100644 --- a/modules/code-generator/src/plugins/component/react/containerInjectDataSourceEngine.ts +++ b/modules/code-generator/src/plugins/component/react/containerInjectDataSourceEngine.ts @@ -6,7 +6,7 @@ import { InterpretDataSourceConfig, isJSExpression, isJSFunction, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import changeCase from 'change-case'; import { @@ -38,7 +38,6 @@ export interface PluginConfig { * 数据源配置 */ datasourceConfig?: { - /** 数据源引擎的版本 */ engineVersion?: string; @@ -189,7 +188,10 @@ const pluginFactory: BuilderComponentPluginFactory = (config?) => export default pluginFactory; -function wrapAsFunction(value: IPublicTypeCompositeValue, scope: IScope): IPublicTypeCompositeValue { +function wrapAsFunction( + value: IPublicTypeCompositeValue, + scope: IScope, +): IPublicTypeCompositeValue { if (isJSExpression(value) || isJSFunction(value) || isJSExpressionFn(value)) { return { type: 'JSExpression', diff --git a/modules/code-generator/src/plugins/component/react/containerLifeCycle.ts b/modules/code-generator/src/plugins/component/react/containerLifeCycle.ts index 5f7d6d22a7..ec4c46e8bd 100644 --- a/modules/code-generator/src/plugins/component/react/containerLifeCycle.ts +++ b/modules/code-generator/src/plugins/component/react/containerLifeCycle.ts @@ -12,7 +12,7 @@ import { ICodeStruct, IContainerInfo, } from '../../../types'; -import { isJSFunction, isJSExpression } from '@alilc/lowcode-types'; +import { isJSFunction, isJSExpression } from '@felce/lowcode-types'; import { isJSExpressionFn } from '../../../utils/common'; export interface PluginConfig { @@ -39,70 +39,72 @@ const pluginFactory: BuilderComponentPluginFactory = (config?) => if (ir.lifeCycles) { const { lifeCycles } = ir; - const chunks = Object.keys(lifeCycles).map((lifeCycleName) => { - // 过滤掉非法数据(有些场景下会误传入空字符串或 null) - if ( - !isJSFunction(lifeCycles[lifeCycleName]) && - !isJSExpressionFn(lifeCycles[lifeCycleName]) && - !isJSExpression(lifeCycles[lifeCycleName]) - ) { - return null; - } - - let normalizeName; - // constructor会取到对象的构造函数 - if (lifeCycleName === 'constructor') { - normalizeName = lifeCycleName; - } else { - normalizeName = cfg.normalizeNameMapping[lifeCycleName] || lifeCycleName; - } - - if (cfg?.exclude?.includes(normalizeName)) { - return null; - } - - const exportName = cfg.exportNameMapping[lifeCycleName] || lifeCycleName; - if (normalizeName === 'constructor') { - return { - type: ChunkType.STRING, - fileType: cfg.fileType, - name: CLASS_DEFINE_CHUNK_NAME.ConstructorContent, - content: generateFunction(lifeCycles[lifeCycleName], { isBlock: true }), - linkAfter: [...DEFAULT_LINK_AFTER[CLASS_DEFINE_CHUNK_NAME.ConstructorStart]], - }; - } - - if (normalizeName === 'componentDidMount') { - return { - type: ChunkType.STRING, - fileType: cfg.fileType, - name: REACT_CHUNK_NAME.ClassDidMountContent, - content: generateFunction(lifeCycles[lifeCycleName], { isBlock: true }), - linkAfter: [REACT_CHUNK_NAME.ClassDidMountStart], - }; - } + const chunks = Object.keys(lifeCycles) + .map((lifeCycleName) => { + // 过滤掉非法数据(有些场景下会误传入空字符串或 null) + if ( + !isJSFunction(lifeCycles[lifeCycleName]) && + !isJSExpressionFn(lifeCycles[lifeCycleName]) && + !isJSExpression(lifeCycles[lifeCycleName]) + ) { + return null; + } + + let normalizeName; + // constructor会取到对象的构造函数 + if (lifeCycleName === 'constructor') { + normalizeName = lifeCycleName; + } else { + normalizeName = cfg.normalizeNameMapping[lifeCycleName] || lifeCycleName; + } + + if (cfg?.exclude?.includes(normalizeName)) { + return null; + } + + const exportName = cfg.exportNameMapping[lifeCycleName] || lifeCycleName; + if (normalizeName === 'constructor') { + return { + type: ChunkType.STRING, + fileType: cfg.fileType, + name: CLASS_DEFINE_CHUNK_NAME.ConstructorContent, + content: generateFunction(lifeCycles[lifeCycleName], { isBlock: true }), + linkAfter: [...DEFAULT_LINK_AFTER[CLASS_DEFINE_CHUNK_NAME.ConstructorStart]], + }; + } + + if (normalizeName === 'componentDidMount') { + return { + type: ChunkType.STRING, + fileType: cfg.fileType, + name: REACT_CHUNK_NAME.ClassDidMountContent, + content: generateFunction(lifeCycles[lifeCycleName], { isBlock: true }), + linkAfter: [REACT_CHUNK_NAME.ClassDidMountStart], + }; + } + + if (normalizeName === 'render') { + return { + type: ChunkType.STRING, + fileType: cfg.fileType, + name: REACT_CHUNK_NAME.ClassRenderPre, + content: generateFunction(lifeCycles[lifeCycleName], { isBlock: true }), + linkAfter: [REACT_CHUNK_NAME.ClassRenderStart], + }; + } - if (normalizeName === 'render') { return { type: ChunkType.STRING, fileType: cfg.fileType, - name: REACT_CHUNK_NAME.ClassRenderPre, - content: generateFunction(lifeCycles[lifeCycleName], { isBlock: true }), - linkAfter: [REACT_CHUNK_NAME.ClassRenderStart], + name: CLASS_DEFINE_CHUNK_NAME.InsMethod, + content: generateFunction(lifeCycles[lifeCycleName], { + name: exportName, + isMember: true, + }), + linkAfter: [...DEFAULT_LINK_AFTER[CLASS_DEFINE_CHUNK_NAME.InsMethod]], }; - } - - return { - type: ChunkType.STRING, - fileType: cfg.fileType, - name: CLASS_DEFINE_CHUNK_NAME.InsMethod, - content: generateFunction(lifeCycles[lifeCycleName], { - name: exportName, - isMember: true, - }), - linkAfter: [...DEFAULT_LINK_AFTER[CLASS_DEFINE_CHUNK_NAME.InsMethod]], - }; - }).filter((i) => !!i); + }) + .filter((i) => !!i); next.chunks.push(...chunks.filter((x): x is ICodeChunk => x !== null)); } diff --git a/modules/code-generator/src/plugins/component/react/jsx.ts b/modules/code-generator/src/plugins/component/react/jsx.ts index 588b356ad6..f8a46c4825 100644 --- a/modules/code-generator/src/plugins/component/react/jsx.ts +++ b/modules/code-generator/src/plugins/component/react/jsx.ts @@ -16,7 +16,7 @@ import { COMMON_CHUNK_NAME } from '../../../const/generator'; import { createReactNodeGenerator } from '../../../utils/nodeToJSX'; import { Scope } from '../../../utils/Scope'; -import { IPublicTypeJSExpression } from '@alilc/lowcode-types'; +import { IPublicTypeJSExpression } from '@felce/lowcode-types'; import { generateExpression } from '../../../utils/jsExpression'; import { transformJsExpr } from '../../../core/jsx/handlers/transformJsExpression'; import { transformThis2Context } from '../../../core/jsx/handlers/transformThis2Context'; diff --git a/modules/code-generator/src/plugins/project/framework/icejs/plugins/packageJSON.ts b/modules/code-generator/src/plugins/project/framework/icejs/plugins/packageJSON.ts index 24fa83e567..cc8003c1e7 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/plugins/packageJSON.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/plugins/packageJSON.ts @@ -1,4 +1,4 @@ -import { PackageJSON } from '@alilc/lowcode-types'; +import { PackageJSON } from '@felce/lowcode-types'; import { COMMON_CHUNK_NAME } from '../../../../../const/generator'; diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/README.md.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/README.md.ts index a908e10730..1a0af6c022 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/README.md.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/README.md.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/abc.json.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/abc.json.ts index c3bc1bb8cd..64c69e8c88 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/abc.json.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/abc.json.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; export default function getFile(): [string[], ResultFile] { return [ diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/build.json.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/build.json.ts index 744e01f9e2..38baba44ad 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/build.json.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/build.json.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; export default function getFile(): [string[], ResultFile] { return [ diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/editorconfig.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/editorconfig.ts index 876b1b02b2..047a28d4c6 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/editorconfig.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/editorconfig.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/eslintignore.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/eslintignore.ts index 9a106bb16d..6f217227b3 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/eslintignore.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/eslintignore.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/eslintrc.js.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/eslintrc.js.ts index 7731c9ee47..2d2838991f 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/eslintrc.js.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/eslintrc.js.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/gitignore.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/gitignore.ts index 5c6eb3f13b..5f93665286 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/gitignore.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/gitignore.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/jsconfig.json.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/jsconfig.json.ts index 5132f3f303..a859c38376 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/jsconfig.json.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/jsconfig.json.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/prettierignore.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/prettierignore.ts index 9e858153bf..18e55fd6ed 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/prettierignore.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/prettierignore.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/prettierrc.js.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/prettierrc.js.ts index 80c3d71ba3..ae48aaaf17 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/prettierrc.js.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/prettierrc.js.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Footer/index.jsx.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Footer/index.jsx.ts index 9647a76439..ae5b302ba1 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Footer/index.jsx.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Footer/index.jsx.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Footer/index.style.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Footer/index.style.ts index 941be0d263..7204e9903c 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Footer/index.style.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Footer/index.style.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Logo/index.jsx.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Logo/index.jsx.ts index 9c078c92c2..bce1af8443 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Logo/index.jsx.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Logo/index.jsx.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Logo/index.style.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Logo/index.style.ts index 5ac92b550f..50fa8d001c 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Logo/index.style.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Logo/index.style.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/PageNav/index.jsx.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/PageNav/index.jsx.ts index ef517bccb7..02b8791bd1 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/PageNav/index.jsx.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/PageNav/index.jsx.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/index.jsx.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/index.jsx.ts index 9c7318dab0..c544e96101 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/index.jsx.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/index.jsx.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/menuConfig.js.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/menuConfig.js.ts index 636539b657..c42b6f3a96 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/menuConfig.js.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/menuConfig.js.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/stylelintignore.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/stylelintignore.ts index cd90e96404..d7db93c40a 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/stylelintignore.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/stylelintignore.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/stylelintrc.js.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/stylelintrc.js.ts index cae73c8438..bb5532a195 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/stylelintrc.js.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/stylelintrc.js.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/files/tsconfig.json.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/files/tsconfig.json.ts index 8d15815c87..ff2e4b619a 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/files/tsconfig.json.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/files/tsconfig.json.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/index.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/index.ts index c03b7956de..edc40a988a 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/index.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/index.ts @@ -1,4 +1,4 @@ -import { ResultDir } from '@alilc/lowcode-types'; +import { ResultDir } from '@felce/lowcode-types'; import { IProjectTemplate } from '../../../../../types'; import { generateStaticFiles } from './static-files'; diff --git a/modules/code-generator/src/plugins/project/framework/icejs/template/static-files.ts b/modules/code-generator/src/plugins/project/framework/icejs/template/static-files.ts index b213e9c2b4..61edb42a35 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs/template/static-files.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs/template/static-files.ts @@ -1,4 +1,4 @@ -import { ResultDir } from '@alilc/lowcode-types'; +import { ResultDir } from '@felce/lowcode-types'; import { createResultDir } from '../../../../../utils/resultHelper'; import { runFileGenerator } from '../../../../../utils/templateHelper'; diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/plugins/buildConfig.ts b/modules/code-generator/src/plugins/project/framework/icejs3/plugins/buildConfig.ts index 322796154a..16842f6ccb 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/plugins/buildConfig.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/plugins/buildConfig.ts @@ -10,7 +10,6 @@ import { format } from '../../../../../utils/format'; import { getThemeInfo } from '../../../../../utils/theme'; export interface BuildConfigPluginConfig { - /** 包名 */ themePackage?: string; } @@ -96,15 +95,19 @@ export default defineConfig(() => ({ 'react-dom/client': 'ReactDOM', '@alifd/next': 'Next', lodash: 'var window._', - '@alilc/lowcode-engine': 'var window.AliLowCodeEngine', + '@felce/lowcode-engine': 'var window.AliLowCodeEngine', }, plugins: [ - fusion(${cfg?.themePackage ? `{ + fusion(${ + cfg?.themePackage + ? `{ importStyle: 'sass', themePackage: '${getThemeInfo(cfg.themePackage).name}', - }` : `{ + }` + : `{ importStyle: 'sass', - }`}), + }` + }), locales(), plugin(), ] @@ -113,10 +116,7 @@ export default defineConfig(() => ({ } function getRoutesContent(navData: any, needShell = true) { - const routes = [ - 'routes: {', - ' defineRoutes: route => {', - ]; + const routes = ['routes: {', ' defineRoutes: route => {']; function _getRoutes(nav: any, _routes: string[] = []) { const { slug, children } = nav; if (children && children.length > 0) { diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/plugins/packageJSON.ts b/modules/code-generator/src/plugins/project/framework/icejs3/plugins/packageJSON.ts index 3c39ba7399..17ad516ae9 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/plugins/packageJSON.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/plugins/packageJSON.ts @@ -1,4 +1,4 @@ -import { PackageJSON } from '@alilc/lowcode-types'; +import { PackageJSON } from '@felce/lowcode-types'; import { COMMON_CHUNK_NAME } from '../../../../../const/generator'; @@ -17,12 +17,10 @@ interface IIceJs3PackageJSON extends PackageJSON { } export type IceJs3PackageJsonPluginConfig = { - /** * 数据源配置 */ datasourceConfig?: { - /** 数据源引擎的版本 */ engineVersion?: string; diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/README.md.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/README.md.ts index e73ab2b82c..eaf805e8dd 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/README.md.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/README.md.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/browserslistrc.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/browserslistrc.ts index a3a346e3ff..373f9bfd86 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/browserslistrc.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/browserslistrc.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/document.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/document.ts index 3345625557..e836603605 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/document.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/document.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; /* eslint-disable max-len */ diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/gitignore.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/gitignore.ts index 5c6eb3f13b..5f93665286 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/gitignore.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/gitignore.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Footer/index.jsx.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Footer/index.jsx.ts index 9647a76439..ae5b302ba1 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Footer/index.jsx.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Footer/index.jsx.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Footer/index.style.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Footer/index.style.ts index 941be0d263..7204e9903c 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Footer/index.style.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Footer/index.style.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Logo/index.jsx.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Logo/index.jsx.ts index 9c078c92c2..bce1af8443 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Logo/index.jsx.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Logo/index.jsx.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Logo/index.style.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Logo/index.style.ts index dfd00dd3e0..83a6f40b0d 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Logo/index.style.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Logo/index.style.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/PageNav/index.jsx.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/PageNav/index.jsx.ts index 1713057566..fdee78f49f 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/PageNav/index.jsx.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/PageNav/index.jsx.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/index.jsx.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/index.jsx.ts index 9c7318dab0..c544e96101 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/index.jsx.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/index.jsx.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/menuConfig.js.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/menuConfig.js.ts index 636539b657..c42b6f3a96 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/menuConfig.js.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/menuConfig.js.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/tsconfig.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/tsconfig.ts index f58639db20..22a1dfa12b 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/tsconfig.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/tsconfig.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/typings.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/typings.ts index c8cbe92545..9ba7fbdc84 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/files/typings.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/files/typings.ts @@ -1,4 +1,4 @@ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; import { createResultFile } from '../../../../../../utils/resultHelper'; export default function getFile(): [string[], ResultFile] { diff --git a/modules/code-generator/src/plugins/project/framework/icejs3/template/static-files.ts b/modules/code-generator/src/plugins/project/framework/icejs3/template/static-files.ts index 8f3794b61a..61b6679b96 100644 --- a/modules/code-generator/src/plugins/project/framework/icejs3/template/static-files.ts +++ b/modules/code-generator/src/plugins/project/framework/icejs3/template/static-files.ts @@ -1,4 +1,4 @@ -import { ResultDir } from '@alilc/lowcode-types'; +import { ResultDir } from '@felce/lowcode-types'; import { createResultDir } from '../../../../../utils/resultHelper'; import { runFileGenerator } from '../../../../../utils/templateHelper'; diff --git a/modules/code-generator/src/plugins/project/framework/rax/plugins/packageJSON.ts b/modules/code-generator/src/plugins/project/framework/rax/plugins/packageJSON.ts index 401ba3f97f..e4143e3db1 100644 --- a/modules/code-generator/src/plugins/project/framework/rax/plugins/packageJSON.ts +++ b/modules/code-generator/src/plugins/project/framework/rax/plugins/packageJSON.ts @@ -1,4 +1,4 @@ -import { IPublicTypeNpmInfo, PackageJSON } from '@alilc/lowcode-types'; +import { IPublicTypeNpmInfo, PackageJSON } from '@felce/lowcode-types'; import { COMMON_CHUNK_NAME } from '../../../../../const/generator'; import { diff --git a/modules/code-generator/src/plugins/project/framework/rax/template/files/.eslintignore.ts b/modules/code-generator/src/plugins/project/framework/rax/template/files/.eslintignore.ts index 9b07005dcc..7934252e63 100644 --- a/modules/code-generator/src/plugins/project/framework/rax/template/files/.eslintignore.ts +++ b/modules/code-generator/src/plugins/project/framework/rax/template/files/.eslintignore.ts @@ -1,7 +1,7 @@ /* eslint-disable max-len */ /* Note: this file is generated by "npm run template", please dont modify this file directly */ /* -- instead, you should modify "static-files/rax/.eslintignore.template" and run "npm run template" */ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; export default function getFile(): [string[], ResultFile] { return [ diff --git a/modules/code-generator/src/plugins/project/framework/rax/template/files/.eslintrc.js.ts b/modules/code-generator/src/plugins/project/framework/rax/template/files/.eslintrc.js.ts index c30947a192..33a638f40e 100644 --- a/modules/code-generator/src/plugins/project/framework/rax/template/files/.eslintrc.js.ts +++ b/modules/code-generator/src/plugins/project/framework/rax/template/files/.eslintrc.js.ts @@ -1,7 +1,7 @@ /* eslint-disable max-len */ /* Note: this file is generated by "npm run template", please dont modify this file directly */ /* -- instead, you should modify "static-files/rax/.eslintrc.js.template" and run "npm run template" */ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; export default function getFile(): [string[], ResultFile] { return [ diff --git a/modules/code-generator/src/plugins/project/framework/rax/template/files/.gitignore.ts b/modules/code-generator/src/plugins/project/framework/rax/template/files/.gitignore.ts index 352ca00f9d..0182e1b841 100644 --- a/modules/code-generator/src/plugins/project/framework/rax/template/files/.gitignore.ts +++ b/modules/code-generator/src/plugins/project/framework/rax/template/files/.gitignore.ts @@ -1,7 +1,7 @@ /* eslint-disable max-len */ /* Note: this file is generated by "npm run template", please dont modify this file directly */ /* -- instead, you should modify "static-files/rax/.gitignore.template" and run "npm run template" */ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; export default function getFile(): [string[], ResultFile] { return [ diff --git a/modules/code-generator/src/plugins/project/framework/rax/template/files/.prettierignore.ts b/modules/code-generator/src/plugins/project/framework/rax/template/files/.prettierignore.ts index be31d87484..deb7444e85 100644 --- a/modules/code-generator/src/plugins/project/framework/rax/template/files/.prettierignore.ts +++ b/modules/code-generator/src/plugins/project/framework/rax/template/files/.prettierignore.ts @@ -1,7 +1,7 @@ /* eslint-disable max-len */ /* Note: this file is generated by "npm run template", please dont modify this file directly */ /* -- instead, you should modify "static-files/rax/.prettierignore.template" and run "npm run template" */ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; export default function getFile(): [string[], ResultFile] { return [ diff --git a/modules/code-generator/src/plugins/project/framework/rax/template/files/.prettierrc.js.ts b/modules/code-generator/src/plugins/project/framework/rax/template/files/.prettierrc.js.ts index 1c70fa1bde..c7f16f09d1 100644 --- a/modules/code-generator/src/plugins/project/framework/rax/template/files/.prettierrc.js.ts +++ b/modules/code-generator/src/plugins/project/framework/rax/template/files/.prettierrc.js.ts @@ -1,7 +1,7 @@ /* eslint-disable max-len */ /* Note: this file is generated by "npm run template", please dont modify this file directly */ /* -- instead, you should modify "static-files/rax/.prettierrc.js.template" and run "npm run template" */ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; export default function getFile(): [string[], ResultFile] { return [ diff --git a/modules/code-generator/src/plugins/project/framework/rax/template/files/.stylelintignore.ts b/modules/code-generator/src/plugins/project/framework/rax/template/files/.stylelintignore.ts index 840994cbeb..323eeac58f 100644 --- a/modules/code-generator/src/plugins/project/framework/rax/template/files/.stylelintignore.ts +++ b/modules/code-generator/src/plugins/project/framework/rax/template/files/.stylelintignore.ts @@ -1,7 +1,7 @@ /* eslint-disable max-len */ /* Note: this file is generated by "npm run template", please dont modify this file directly */ /* -- instead, you should modify "static-files/rax/.stylelintignore.template" and run "npm run template" */ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; export default function getFile(): [string[], ResultFile] { return [ diff --git a/modules/code-generator/src/plugins/project/framework/rax/template/files/.stylelintrc.js.ts b/modules/code-generator/src/plugins/project/framework/rax/template/files/.stylelintrc.js.ts index adbca1440c..d54a6e9d40 100644 --- a/modules/code-generator/src/plugins/project/framework/rax/template/files/.stylelintrc.js.ts +++ b/modules/code-generator/src/plugins/project/framework/rax/template/files/.stylelintrc.js.ts @@ -1,7 +1,7 @@ /* eslint-disable max-len */ /* Note: this file is generated by "npm run template", please dont modify this file directly */ /* -- instead, you should modify "static-files/rax/.stylelintrc.js.template" and run "npm run template" */ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; export default function getFile(): [string[], ResultFile] { return [ diff --git a/modules/code-generator/src/plugins/project/framework/rax/template/files/README.md.ts b/modules/code-generator/src/plugins/project/framework/rax/template/files/README.md.ts index d7e220046c..2b361c3630 100644 --- a/modules/code-generator/src/plugins/project/framework/rax/template/files/README.md.ts +++ b/modules/code-generator/src/plugins/project/framework/rax/template/files/README.md.ts @@ -1,7 +1,7 @@ /* eslint-disable max-len */ /* Note: this file is generated by "npm run template", please dont modify this file directly */ /* -- instead, you should modify "static-files/rax/README.md.template" and run "npm run template" */ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; export default function getFile(): [string[], ResultFile] { return [ diff --git a/modules/code-generator/src/plugins/project/framework/rax/template/files/jsconfig.json.ts b/modules/code-generator/src/plugins/project/framework/rax/template/files/jsconfig.json.ts index f70fa1f19a..b856f40a69 100644 --- a/modules/code-generator/src/plugins/project/framework/rax/template/files/jsconfig.json.ts +++ b/modules/code-generator/src/plugins/project/framework/rax/template/files/jsconfig.json.ts @@ -1,7 +1,7 @@ /* eslint-disable max-len */ /* Note: this file is generated by "npm run template", please dont modify this file directly */ /* -- instead, you should modify "static-files/rax/jsconfig.json.template" and run "npm run template" */ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; export default function getFile(): [string[], ResultFile] { return [ diff --git a/modules/code-generator/src/plugins/project/framework/rax/template/files/tsconfig.json.ts b/modules/code-generator/src/plugins/project/framework/rax/template/files/tsconfig.json.ts index c29d2cd4b2..ff86c8fe44 100644 --- a/modules/code-generator/src/plugins/project/framework/rax/template/files/tsconfig.json.ts +++ b/modules/code-generator/src/plugins/project/framework/rax/template/files/tsconfig.json.ts @@ -1,7 +1,7 @@ /* eslint-disable max-len */ /* Note: this file is generated by "npm run template", please dont modify this file directly */ /* -- instead, you should modify "static-files/rax/tsconfig.json.template" and run "npm run template" */ -import { ResultFile } from '@alilc/lowcode-types'; +import { ResultFile } from '@felce/lowcode-types'; export default function getFile(): [string[], ResultFile] { return [ diff --git a/modules/code-generator/src/plugins/project/framework/rax/template/index.ts b/modules/code-generator/src/plugins/project/framework/rax/template/index.ts index aa37944864..7e208f0473 100644 --- a/modules/code-generator/src/plugins/project/framework/rax/template/index.ts +++ b/modules/code-generator/src/plugins/project/framework/rax/template/index.ts @@ -1,4 +1,4 @@ -import { ResultDir } from '@alilc/lowcode-types'; +import { ResultDir } from '@felce/lowcode-types'; import { IProjectTemplate } from '../../../../../types'; import { generateStaticFiles } from './static-files'; diff --git a/modules/code-generator/src/plugins/project/framework/rax/template/static-files.ts b/modules/code-generator/src/plugins/project/framework/rax/template/static-files.ts index 2b5b9249f4..2591dbd6e9 100644 --- a/modules/code-generator/src/plugins/project/framework/rax/template/static-files.ts +++ b/modules/code-generator/src/plugins/project/framework/rax/template/static-files.ts @@ -1,5 +1,5 @@ /* Note: this file is generated by "npm run template", please dont modify this file directly */ -import { ResultDir } from '@alilc/lowcode-types'; +import { ResultDir } from '@felce/lowcode-types'; import { createResultDir } from '../../../../../utils/resultHelper'; import { runFileGenerator } from '../../../../../utils/templateHelper'; diff --git a/modules/code-generator/src/publisher/disk/index.ts b/modules/code-generator/src/publisher/disk/index.ts index bf414963ed..aa998a31e7 100644 --- a/modules/code-generator/src/publisher/disk/index.ts +++ b/modules/code-generator/src/publisher/disk/index.ts @@ -1,6 +1,6 @@ import * as defaultFs from 'fs'; -import { ResultDir } from '@alilc/lowcode-types'; +import { ResultDir } from '@felce/lowcode-types'; import { PublisherFactory, IPublisher, IPublisherFactoryParams, PublisherError } from '../../types'; import { getErrorMessage } from '../../utils/errors'; import { writeFolder, IFileSystem } from './utils'; diff --git a/modules/code-generator/src/publisher/disk/utils.ts b/modules/code-generator/src/publisher/disk/utils.ts index 4d69237c8f..6f31257364 100644 --- a/modules/code-generator/src/publisher/disk/utils.ts +++ b/modules/code-generator/src/publisher/disk/utils.ts @@ -1,6 +1,6 @@ import * as systemFs from 'fs'; import { join } from 'path'; -import { ResultDir, ResultFile } from '@alilc/lowcode-types'; +import { ResultDir, ResultFile } from '@felce/lowcode-types'; export interface IFileSystem { existsSync: typeof systemFs.existsSync; diff --git a/modules/code-generator/src/publisher/zip/index.ts b/modules/code-generator/src/publisher/zip/index.ts index 0ac0b6f67f..2a59343020 100644 --- a/modules/code-generator/src/publisher/zip/index.ts +++ b/modules/code-generator/src/publisher/zip/index.ts @@ -1,4 +1,4 @@ -import { ResultDir } from '@alilc/lowcode-types'; +import { ResultDir } from '@felce/lowcode-types'; import { PublisherFactory, IPublisher, IPublisherFactoryParams, PublisherError } from '../../types'; import { getErrorMessage } from '../../utils/errors'; import { isNodeProcess, writeZipToDisk, generateProjectZip } from './utils'; diff --git a/modules/code-generator/src/publisher/zip/utils.ts b/modules/code-generator/src/publisher/zip/utils.ts index 08d3a12f44..cd219870da 100644 --- a/modules/code-generator/src/publisher/zip/utils.ts +++ b/modules/code-generator/src/publisher/zip/utils.ts @@ -1,5 +1,5 @@ import JSZip from 'jszip'; -import { ResultDir, ResultFile } from '@alilc/lowcode-types'; +import { ResultDir, ResultFile } from '@felce/lowcode-types'; import type { ZipBuffer } from './index'; export const isNodeProcess = (): boolean => { diff --git a/modules/code-generator/src/standalone-loader.ts b/modules/code-generator/src/standalone-loader.ts index 0c8903ddcb..0126761de4 100644 --- a/modules/code-generator/src/standalone-loader.ts +++ b/modules/code-generator/src/standalone-loader.ts @@ -1,5 +1,5 @@ import fetch from 'node-fetch'; -import type { IPublicTypeProjectSchema, ResultDir } from '@alilc/lowcode-types'; +import type { IPublicTypeProjectSchema, ResultDir } from '@felce/lowcode-types'; import type { FlattenFile } from './types/file'; declare const Worker: any; @@ -8,7 +8,7 @@ declare const __PACKAGE_VERSION__: string; const packageVersion = __PACKAGE_VERSION__ || 'latest'; -export const DEFAULT_WORKER_JS = `https://cdn.jsdelivr.net/npm/@alilc/lowcode-code-generator@${packageVersion}/dist/standalone-worker.min.js`; +export const DEFAULT_WORKER_JS = `https://cdn.jsdelivr.net/npm/@felce/lowcode-code-generator@${packageVersion}/dist/standalone-worker.min.js`; export const DEFAULT_TIMEOUT_IN_MS = 60 * 1000; diff --git a/modules/code-generator/src/standalone-worker.ts b/modules/code-generator/src/standalone-worker.ts index e00a4877bf..e44d2afe1e 100644 --- a/modules/code-generator/src/standalone-worker.ts +++ b/modules/code-generator/src/standalone-worker.ts @@ -1,5 +1,5 @@ /* eslint-disable no-console */ -import type { IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import type { IPublicTypeProjectSchema } from '@felce/lowcode-types'; import CodeGen from './standalone'; declare const self: any; @@ -13,7 +13,11 @@ self.onmessage = (event: any) => { self.postMessage({ type: 'ready' }); -async function run(msg: { solution: string; schema: IPublicTypeProjectSchema; flattenResult?: boolean }) { +async function run(msg: { + solution: string; + schema: IPublicTypeProjectSchema; + flattenResult?: boolean; +}) { try { print('begin run...'); self.postMessage({ type: 'run:begin' }); diff --git a/modules/code-generator/src/types/analyze.ts b/modules/code-generator/src/types/analyze.ts index 3bf444d29e..cb63c92a22 100644 --- a/modules/code-generator/src/types/analyze.ts +++ b/modules/code-generator/src/types/analyze.ts @@ -1,4 +1,4 @@ -import type { IPublicTypeContainerSchema } from '@alilc/lowcode-types'; +import type { IPublicTypeContainerSchema } from '@felce/lowcode-types'; export interface ICompAnalyzeResult { isUsingRef: boolean; diff --git a/modules/code-generator/src/types/core.ts b/modules/code-generator/src/types/core.ts index 1219a1e767..7f0cccde86 100644 --- a/modules/code-generator/src/types/core.ts +++ b/modules/code-generator/src/types/core.ts @@ -1,11 +1,16 @@ import { IPublicTypeCompositeArray, - IPublicTypeCompositeObject, IPublicTypeJSExpression, - IPublicTypeJSFunction, IPublicTypeJSONArray, - IPublicTypeJSONObject, IPublicTypeJSSlot, IPublicTypeNodeDataType, - IPublicTypeProjectSchema, ResultDir, + IPublicTypeCompositeObject, + IPublicTypeJSExpression, + IPublicTypeJSFunction, + IPublicTypeJSONArray, + IPublicTypeJSONObject, + IPublicTypeJSSlot, + IPublicTypeNodeDataType, + IPublicTypeProjectSchema, + ResultDir, ResultFile, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import type { ProjectBuilderInitOptions } from '../generator/ProjectBuilder'; import { IScopeBindings } from '../utils/ScopeBindings'; @@ -63,7 +68,6 @@ export interface ICodeStruct extends IBaseCodeStruct { /** 上下文数据,用来在插件之间共享一些数据 */ export interface IContextData extends IProjectBuilderOptions { - /** * 其他自定义数据 * (三方自定义插件也可以在此放一些数据,建议起个长一点的名称,用自己的插件名做前缀,以防冲突) @@ -109,7 +113,6 @@ export interface IModuleBuilder { * @interface ICodeGenerator */ export interface ICodeGenerator { - /** * 出码接口,把 Schema 转换成代码文件系统描述 * @@ -140,7 +143,6 @@ export interface IProjectPlugins { } export interface IProjectBuilderOptions { - /** 是否处于严格模式 (默认:否) */ inStrictMode?: boolean; @@ -178,8 +180,9 @@ export interface IProjectBuilder { } /** 项目级别的前置处理器 */ -export type ProjectPreProcessor = (schema: IPublicTypeProjectSchema) => - Promise | IPublicTypeProjectSchema; +export type ProjectPreProcessor = ( + schema: IPublicTypeProjectSchema, +) => Promise | IPublicTypeProjectSchema; export interface ProjectPostProcessorOptions { parseResult?: IParseResult; diff --git a/modules/code-generator/src/types/intermediate.ts b/modules/code-generator/src/types/intermediate.ts index 7cba0bd44b..6404c01d9a 100644 --- a/modules/code-generator/src/types/intermediate.ts +++ b/modules/code-generator/src/types/intermediate.ts @@ -3,7 +3,7 @@ import { IPublicTypeUtilsMap, IPublicTypeContainerSchema, IPublicTypeJSONObject, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { IDependency, INpmPackage } from './deps'; import { ICompAnalyzeResult } from './analyze'; @@ -42,7 +42,6 @@ export interface IRouterInfo extends IWithDependency { * project's remarks */ export interface ProjectRemark { - /** if current project only contain one container which type is `Component` */ isSingleComponent?: boolean; } diff --git a/modules/code-generator/src/types/jsx.ts b/modules/code-generator/src/types/jsx.ts index 28f948d639..d9ed8966aa 100644 --- a/modules/code-generator/src/types/jsx.ts +++ b/modules/code-generator/src/types/jsx.ts @@ -1,4 +1,4 @@ -import { IPublicTypeNodeSchema, IPublicTypeCompositeValue } from '@alilc/lowcode-types'; +import { IPublicTypeNodeSchema, IPublicTypeCompositeValue } from '@felce/lowcode-types'; import { HandlerSet, BaseGenerator, NodeGenerator } from './core'; export enum PIECE_TYPE { diff --git a/modules/code-generator/src/types/publisher.ts b/modules/code-generator/src/types/publisher.ts index 5df5145df0..70b614f392 100644 --- a/modules/code-generator/src/types/publisher.ts +++ b/modules/code-generator/src/types/publisher.ts @@ -1,4 +1,4 @@ -import { ResultDir } from '@alilc/lowcode-types'; +import { ResultDir } from '@felce/lowcode-types'; export type PublisherFactory = (configuration?: Partial) => U; diff --git a/modules/code-generator/src/utils/common.ts b/modules/code-generator/src/utils/common.ts index fa7ab30a95..045fea6c2f 100644 --- a/modules/code-generator/src/utils/common.ts +++ b/modules/code-generator/src/utils/common.ts @@ -1,4 +1,4 @@ -import type { IPublicTypeJSExpression, IPublicTypeJSFunction } from '@alilc/lowcode-types'; +import type { IPublicTypeJSExpression, IPublicTypeJSFunction } from '@felce/lowcode-types'; import changeCase from 'change-case'; import short from 'short-uuid'; import { DependencyType, IDependency, IExternalDependency, IInternalDependency } from '../types'; @@ -46,14 +46,10 @@ export function isJSExpressionFn(data: any): data is IPublicTypeJSFunction { return data?.type === 'JSExpression' && data?.extType === 'function'; } -export function isInternalDependency( - dependency: IDependency, -): dependency is IInternalDependency { +export function isInternalDependency(dependency: IDependency): dependency is IInternalDependency { return dependency.dependencyType === DependencyType.Internal; } -export function isExternalDependency( - dependency: IDependency, -): dependency is IExternalDependency { +export function isExternalDependency(dependency: IDependency): dependency is IExternalDependency { return dependency.dependencyType === DependencyType.External; -} \ No newline at end of file +} diff --git a/modules/code-generator/src/utils/compositeType.ts b/modules/code-generator/src/utils/compositeType.ts index 0dd612641d..5628303130 100644 --- a/modules/code-generator/src/utils/compositeType.ts +++ b/modules/code-generator/src/utils/compositeType.ts @@ -8,7 +8,7 @@ import { isJSFunction, isJSSlot, IPublicTypeJSSlot, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import _ from 'lodash'; import { IScope, CompositeValueGeneratorOptions, CodeGeneratorError } from '../types'; @@ -99,7 +99,11 @@ function genFunction(value: IPublicTypeJSFunction): string { return generateFunction(value, { isArrow: true }); } -function genJsSlot(value: IPublicTypeJSSlot, scope: IScope, options: CompositeValueGeneratorOptions = {}) { +function genJsSlot( + value: IPublicTypeJSSlot, + scope: IScope, + options: CompositeValueGeneratorOptions = {}, +) { if (options.nodeGenerator) { return generateJsSlot(value, scope, options.nodeGenerator); } diff --git a/modules/code-generator/src/utils/jsExpression.ts b/modules/code-generator/src/utils/jsExpression.ts index 08d2fafd8a..fa05f36c08 100644 --- a/modules/code-generator/src/utils/jsExpression.ts +++ b/modules/code-generator/src/utils/jsExpression.ts @@ -2,7 +2,12 @@ import * as parser from '@babel/parser'; import generate from '@babel/generator'; import traverse from '@babel/traverse'; import * as t from '@babel/types'; -import { IPublicTypeJSExpression, IPublicTypeJSFunction, isJSExpression, isJSFunction } from '@alilc/lowcode-types'; +import { + IPublicTypeJSExpression, + IPublicTypeJSFunction, + isJSExpression, + isJSFunction, +} from '@felce/lowcode-types'; import { CodeGeneratorError, IScope } from '../types'; import { transformExpressionLocalRef, ParseError } from './expressionParser'; import { isJSExpressionFn } from './common'; @@ -10,9 +15,7 @@ import { isJSExpressionFn } from './common'; function parseFunction(content: string): t.FunctionExpression | null { try { const ast = parser.parse(`(${content});`, { - plugins: [ - 'jsx', - ], + plugins: ['jsx'], }); let resultNode: t.FunctionExpression | null = null; diff --git a/modules/code-generator/src/utils/jsSlot.ts b/modules/code-generator/src/utils/jsSlot.ts index 265f6857f2..03a018c329 100644 --- a/modules/code-generator/src/utils/jsSlot.ts +++ b/modules/code-generator/src/utils/jsSlot.ts @@ -1,4 +1,4 @@ -import { IPublicTypeJSSlot, isJSSlot, IPublicTypeNodeData } from '@alilc/lowcode-types'; +import { IPublicTypeJSSlot, isJSSlot, IPublicTypeNodeData } from '@felce/lowcode-types'; import { CodeGeneratorError, NodeGenerator, IScope } from '../types'; import { unwrapJsExprQuoteInJsx } from './jsxHelpers'; diff --git a/modules/code-generator/src/utils/nodeToJSX.ts b/modules/code-generator/src/utils/nodeToJSX.ts index d29f28762c..71c99ebddc 100644 --- a/modules/code-generator/src/utils/nodeToJSX.ts +++ b/modules/code-generator/src/utils/nodeToJSX.ts @@ -1,6 +1,11 @@ import _ from 'lodash'; import { pipe } from 'fp-ts/function'; -import { IPublicTypeNodeSchema, isNodeSchema, IPublicTypeNodeDataType, IPublicTypeCompositeValue } from '@alilc/lowcode-types'; +import { + IPublicTypeNodeSchema, + isNodeSchema, + IPublicTypeNodeDataType, + IPublicTypeCompositeValue, +} from '@felce/lowcode-types'; import { IScope, @@ -128,7 +133,9 @@ function generateAttrs( if (!Array.isArray(props)) { Object.keys(props).forEach((propName: string) => { if (isValidIdentifier(propName)) { - pieces = pieces.concat(generateAttr(propName, props[propName] as IPublicTypeCompositeValue, scope, config)); + pieces = pieces.concat( + generateAttr(propName, props[propName] as IPublicTypeCompositeValue, scope, config), + ); } }); } else { @@ -273,7 +280,8 @@ export function generateReactLoopCtrl( const loopDataExpr = pipe( nodeItem.loop, // 将 JSExpression 转换为 JS 表达式代码: - (expr) => generateCompositeType(expr, scope, { + (expr) => + generateCompositeType(expr, scope, { handlers: config?.handlers, tolerateEvalErrors: false, // 这个内部不需要包 try catch, 下面会统一加的 }), @@ -393,7 +401,8 @@ export function createNodeGenerator(cfg: NodeGeneratorConfig = {}): NodeGenerato return `{${valueStr}}`; }; - return (nodeItem: IPublicTypeNodeDataType, scope: IScope) => unwrapJsExprQuoteInJsx(generateNode(nodeItem, scope)); + return (nodeItem: IPublicTypeNodeDataType, scope: IScope) => + unwrapJsExprQuoteInJsx(generateNode(nodeItem, scope)); } const defaultReactGeneratorConfig: NodeGeneratorConfig = { diff --git a/modules/code-generator/src/utils/resultHelper.ts b/modules/code-generator/src/utils/resultHelper.ts index d7a3ef5653..28b6e9adfd 100644 --- a/modules/code-generator/src/utils/resultHelper.ts +++ b/modules/code-generator/src/utils/resultHelper.ts @@ -1,4 +1,4 @@ -import { ResultFile, ResultDir } from '@alilc/lowcode-types'; +import { ResultFile, ResultDir } from '@felce/lowcode-types'; import nm from 'nanomatch'; import { CodeGeneratorError } from '../types/error'; diff --git a/modules/code-generator/src/utils/schema.ts b/modules/code-generator/src/utils/schema.ts index f9529945eb..338a35becd 100644 --- a/modules/code-generator/src/utils/schema.ts +++ b/modules/code-generator/src/utils/schema.ts @@ -11,7 +11,7 @@ import { IPublicTypeCompositeValue, isNodeSchema, isJSFunction, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { CodeGeneratorError } from '../types/error'; import { isJSExpressionFn } from './common'; @@ -142,15 +142,11 @@ export function handleSubNodes( } export function isValidContainerType(schema: IPublicTypeNodeSchema) { - return [ - 'Page', - 'Component', - 'Block', - ].includes(schema.componentName); + return ['Page', 'Component', 'Block'].includes(schema.componentName); } export const enum ContainerType { Page = 'Page', Component = 'Component', Block = 'Block', -} \ No newline at end of file +} diff --git a/modules/code-generator/src/utils/templateHelper.ts b/modules/code-generator/src/utils/templateHelper.ts index 8602ff258b..894c6f97e2 100644 --- a/modules/code-generator/src/utils/templateHelper.ts +++ b/modules/code-generator/src/utils/templateHelper.ts @@ -1,4 +1,4 @@ -import { ResultDir, ResultFile } from '@alilc/lowcode-types'; +import { ResultDir, ResultFile } from '@felce/lowcode-types'; import { createResultDir, addDirectory, addFile } from './resultHelper'; type FuncFileGenerator = () => [string[], ResultFile]; diff --git a/modules/code-generator/tests/bugfix/i18n-with-params.test.ts b/modules/code-generator/tests/bugfix/i18n-with-params.test.ts index b58afda8cf..b63f7122a8 100644 --- a/modules/code-generator/tests/bugfix/i18n-with-params.test.ts +++ b/modules/code-generator/tests/bugfix/i18n-with-params.test.ts @@ -1,7 +1,7 @@ import CodeGenerator from '../../src'; import * as fs from 'fs'; import * as path from 'path'; -import { IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import { IPublicTypeProjectSchema } from '@felce/lowcode-types'; import { createDiskPublisher } from '../helpers/solutionHelper'; const testCaseBaseName = path.basename(__filename, '.test.ts'); diff --git a/modules/code-generator/tests/bugfix/icejs-import-wrong-naming.test.ts b/modules/code-generator/tests/bugfix/icejs-import-wrong-naming.test.ts index efb7fd5bee..2c0ce911fc 100644 --- a/modules/code-generator/tests/bugfix/icejs-import-wrong-naming.test.ts +++ b/modules/code-generator/tests/bugfix/icejs-import-wrong-naming.test.ts @@ -1,7 +1,7 @@ import CodeGenerator from '../../src'; import * as fs from 'fs'; import * as path from 'path'; -import { IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import { IPublicTypeProjectSchema } from '@felce/lowcode-types'; import { createDiskPublisher } from '../helpers/solutionHelper'; const testCaseBaseName = path.basename(__filename, '.test.ts'); @@ -27,7 +27,7 @@ describe(testCaseBaseName, () => { }); const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx'); - expect(generatedPageFileContent).toContain('import Foo from \'example-package/lib/index.js\';'); + expect(generatedPageFileContent).toContain("import Foo from 'example-package/lib/index.js';"); }); test('named import with no alias', async () => { @@ -47,7 +47,7 @@ describe(testCaseBaseName, () => { const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx'); expect(generatedPageFileContent).toContain( - 'import { Foo } from \'example-package/lib/index.js\';', + "import { Foo } from 'example-package/lib/index.js';", ); }); @@ -68,7 +68,7 @@ describe(testCaseBaseName, () => { const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx'); expect(generatedPageFileContent).toContain( - 'import { Bar as Foo } from \'example-package/lib/index.js\';', + "import { Bar as Foo } from 'example-package/lib/index.js';", ); }); @@ -88,7 +88,7 @@ describe(testCaseBaseName, () => { }); const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx'); - expect(generatedPageFileContent).toContain('import Foo from \'example-package/lib/index.js\';'); + expect(generatedPageFileContent).toContain("import Foo from 'example-package/lib/index.js';"); }); test('default import with sub name and export name', async () => { @@ -107,7 +107,7 @@ describe(testCaseBaseName, () => { }); const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx'); - expect(generatedPageFileContent).toContain('import Bar from \'example-package/lib/index.js\';'); + expect(generatedPageFileContent).toContain("import Bar from 'example-package/lib/index.js';"); expect(generatedPageFileContent).toContain('const Foo = Bar.Baz;'); }); @@ -129,7 +129,7 @@ describe(testCaseBaseName, () => { const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx'); expect(generatedPageFileContent).toContain( - 'import __$examplePackage_default from \'example-package/lib/index.js\';', + "import __$examplePackage_default from 'example-package/lib/index.js';", ); expect(generatedPageFileContent).toContain('const Foo = __$examplePackage_default.Baz;'); @@ -152,7 +152,7 @@ describe(testCaseBaseName, () => { const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx'); expect(generatedPageFileContent).toContain( - 'import { Bar } from \'example-package/lib/index.js\';', + "import { Bar } from 'example-package/lib/index.js';", ); expect(generatedPageFileContent).toContain('const Foo = Bar.Baz;'); @@ -187,8 +187,8 @@ describe(testCaseBaseName, () => { }); const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx'); - expect(generatedPageFileContent).toContain('import Foo from \'example-package\';'); - expect(generatedPageFileContent).toContain('import Baz from \'example-package\';'); + expect(generatedPageFileContent).toContain("import Foo from 'example-package';"); + expect(generatedPageFileContent).toContain("import Baz from 'example-package';"); expect(generatedPageFileContent).not.toContain('const Foo ='); expect(generatedPageFileContent).not.toContain('const Baz ='); diff --git a/modules/code-generator/tests/bugfix/strict-mode-context-1.test.ts b/modules/code-generator/tests/bugfix/strict-mode-context-1.test.ts index ebca6a26fd..bbeba067ad 100644 --- a/modules/code-generator/tests/bugfix/strict-mode-context-1.test.ts +++ b/modules/code-generator/tests/bugfix/strict-mode-context-1.test.ts @@ -1,7 +1,7 @@ import CodeGenerator from '../../src'; import * as fs from 'fs'; import * as path from 'path'; -import { IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import { IPublicTypeProjectSchema } from '@felce/lowcode-types'; import { createDiskPublisher } from '../helpers/solutionHelper'; import { IceJsProjectBuilderOptions } from '../../src/solutions/icejs'; diff --git a/modules/code-generator/tests/bugfix/tolerate-eval-errors-1-loop.test.ts b/modules/code-generator/tests/bugfix/tolerate-eval-errors-1-loop.test.ts index 78f2b50b32..5564a7f22b 100644 --- a/modules/code-generator/tests/bugfix/tolerate-eval-errors-1-loop.test.ts +++ b/modules/code-generator/tests/bugfix/tolerate-eval-errors-1-loop.test.ts @@ -1,7 +1,7 @@ import CodeGenerator from '../../src'; import * as fs from 'fs'; import * as path from 'path'; -import { IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import { IPublicTypeProjectSchema } from '@felce/lowcode-types'; import { createDiskPublisher } from '../helpers/solutionHelper'; import { IceJsProjectBuilderOptions } from '../../src/solutions/icejs'; diff --git a/modules/code-generator/tests/bugfix/tolerate-eval-errors-2-nested-loop.test.ts b/modules/code-generator/tests/bugfix/tolerate-eval-errors-2-nested-loop.test.ts index 1842005938..90f21b590b 100644 --- a/modules/code-generator/tests/bugfix/tolerate-eval-errors-2-nested-loop.test.ts +++ b/modules/code-generator/tests/bugfix/tolerate-eval-errors-2-nested-loop.test.ts @@ -1,7 +1,7 @@ import CodeGenerator from '../../src'; import * as fs from 'fs'; import * as path from 'path'; -import { IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import { IPublicTypeProjectSchema } from '@felce/lowcode-types'; import { createDiskPublisher } from '../helpers/solutionHelper'; import { IceJsProjectBuilderOptions } from '../../src/solutions/icejs'; diff --git a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo1/expected/demo-project/ice.config.mts b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo1/expected/demo-project/ice.config.mts index e1d8a28141..84a44ccd62 100644 --- a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo1/expected/demo-project/ice.config.mts +++ b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo1/expected/demo-project/ice.config.mts @@ -77,7 +77,7 @@ export default defineConfig(() => ({ 'react-dom/client': 'ReactDOM', '@alifd/next': 'Next', lodash: 'var window._', - '@alilc/lowcode-engine': 'var window.AliLowCodeEngine', + '@felce/lowcode-engine': 'var window.AliLowCodeEngine', }, plugins: [ fusion({ @@ -87,4 +87,3 @@ export default defineConfig(() => ({ plugin(), ], })); - diff --git a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo2-utils-name-alias/expected/demo-project/ice.config.mts b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo2-utils-name-alias/expected/demo-project/ice.config.mts index e1d8a28141..84a44ccd62 100644 --- a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo2-utils-name-alias/expected/demo-project/ice.config.mts +++ b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo2-utils-name-alias/expected/demo-project/ice.config.mts @@ -77,7 +77,7 @@ export default defineConfig(() => ({ 'react-dom/client': 'ReactDOM', '@alifd/next': 'Next', lodash: 'var window._', - '@alilc/lowcode-engine': 'var window.AliLowCodeEngine', + '@felce/lowcode-engine': 'var window.AliLowCodeEngine', }, plugins: [ fusion({ @@ -87,4 +87,3 @@ export default defineConfig(() => ({ plugin(), ], })); - diff --git a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo2/expected/demo-project/ice.config.mts b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo2/expected/demo-project/ice.config.mts index e1d8a28141..84a44ccd62 100644 --- a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo2/expected/demo-project/ice.config.mts +++ b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo2/expected/demo-project/ice.config.mts @@ -77,7 +77,7 @@ export default defineConfig(() => ({ 'react-dom/client': 'ReactDOM', '@alifd/next': 'Next', lodash: 'var window._', - '@alilc/lowcode-engine': 'var window.AliLowCodeEngine', + '@felce/lowcode-engine': 'var window.AliLowCodeEngine', }, plugins: [ fusion({ @@ -87,4 +87,3 @@ export default defineConfig(() => ({ plugin(), ], })); - diff --git a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo3/expected/demo-project/ice.config.mts b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo3/expected/demo-project/ice.config.mts index e1d8a28141..84a44ccd62 100644 --- a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo3/expected/demo-project/ice.config.mts +++ b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo3/expected/demo-project/ice.config.mts @@ -77,7 +77,7 @@ export default defineConfig(() => ({ 'react-dom/client': 'ReactDOM', '@alifd/next': 'Next', lodash: 'var window._', - '@alilc/lowcode-engine': 'var window.AliLowCodeEngine', + '@felce/lowcode-engine': 'var window.AliLowCodeEngine', }, plugins: [ fusion({ @@ -87,4 +87,3 @@ export default defineConfig(() => ({ plugin(), ], })); - diff --git a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo4/expected/demo-project/ice.config.mts b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo4/expected/demo-project/ice.config.mts index e1d8a28141..84a44ccd62 100644 --- a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo4/expected/demo-project/ice.config.mts +++ b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo4/expected/demo-project/ice.config.mts @@ -77,7 +77,7 @@ export default defineConfig(() => ({ 'react-dom/client': 'ReactDOM', '@alifd/next': 'Next', lodash: 'var window._', - '@alilc/lowcode-engine': 'var window.AliLowCodeEngine', + '@felce/lowcode-engine': 'var window.AliLowCodeEngine', }, plugins: [ fusion({ @@ -87,4 +87,3 @@ export default defineConfig(() => ({ plugin(), ], })); - diff --git a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo5/expected/demo-project/ice.config.mts b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo5/expected/demo-project/ice.config.mts index e1d8a28141..84a44ccd62 100644 --- a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo5/expected/demo-project/ice.config.mts +++ b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo5/expected/demo-project/ice.config.mts @@ -77,7 +77,7 @@ export default defineConfig(() => ({ 'react-dom/client': 'ReactDOM', '@alifd/next': 'Next', lodash: 'var window._', - '@alilc/lowcode-engine': 'var window.AliLowCodeEngine', + '@felce/lowcode-engine': 'var window.AliLowCodeEngine', }, plugins: [ fusion({ @@ -87,4 +87,3 @@ export default defineConfig(() => ({ plugin(), ], })); - diff --git a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo6-literal-condition/expected/demo-project/ice.config.mts b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo6-literal-condition/expected/demo-project/ice.config.mts index e1d8a28141..84a44ccd62 100644 --- a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo6-literal-condition/expected/demo-project/ice.config.mts +++ b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo6-literal-condition/expected/demo-project/ice.config.mts @@ -77,7 +77,7 @@ export default defineConfig(() => ({ 'react-dom/client': 'ReactDOM', '@alifd/next': 'Next', lodash: 'var window._', - '@alilc/lowcode-engine': 'var window.AliLowCodeEngine', + '@felce/lowcode-engine': 'var window.AliLowCodeEngine', }, plugins: [ fusion({ @@ -87,4 +87,3 @@ export default defineConfig(() => ({ plugin(), ], })); - diff --git a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo7-literal-condition2/expected/demo-project/ice.config.mts b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo7-literal-condition2/expected/demo-project/ice.config.mts index e1d8a28141..84a44ccd62 100644 --- a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo7-literal-condition2/expected/demo-project/ice.config.mts +++ b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo7-literal-condition2/expected/demo-project/ice.config.mts @@ -77,7 +77,7 @@ export default defineConfig(() => ({ 'react-dom/client': 'ReactDOM', '@alifd/next': 'Next', lodash: 'var window._', - '@alilc/lowcode-engine': 'var window.AliLowCodeEngine', + '@felce/lowcode-engine': 'var window.AliLowCodeEngine', }, plugins: [ fusion({ @@ -87,4 +87,3 @@ export default defineConfig(() => ({ plugin(), ], })); - diff --git a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo8-datasource-prop/expected/demo-project/ice.config.mts b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo8-datasource-prop/expected/demo-project/ice.config.mts index e1d8a28141..84a44ccd62 100644 --- a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo8-datasource-prop/expected/demo-project/ice.config.mts +++ b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo8-datasource-prop/expected/demo-project/ice.config.mts @@ -77,7 +77,7 @@ export default defineConfig(() => ({ 'react-dom/client': 'ReactDOM', '@alifd/next': 'Next', lodash: 'var window._', - '@alilc/lowcode-engine': 'var window.AliLowCodeEngine', + '@felce/lowcode-engine': 'var window.AliLowCodeEngine', }, plugins: [ fusion({ @@ -87,4 +87,3 @@ export default defineConfig(() => ({ plugin(), ], })); - diff --git a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo9-datasource-engine/expected/demo-project/ice.config.mts b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo9-datasource-engine/expected/demo-project/ice.config.mts index e1d8a28141..84a44ccd62 100644 --- a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo9-datasource-engine/expected/demo-project/ice.config.mts +++ b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo9-datasource-engine/expected/demo-project/ice.config.mts @@ -77,7 +77,7 @@ export default defineConfig(() => ({ 'react-dom/client': 'ReactDOM', '@alifd/next': 'Next', lodash: 'var window._', - '@alilc/lowcode-engine': 'var window.AliLowCodeEngine', + '@felce/lowcode-engine': 'var window.AliLowCodeEngine', }, plugins: [ fusion({ @@ -87,4 +87,3 @@ export default defineConfig(() => ({ plugin(), ], })); - diff --git a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo_10-jsslot/expected/demo-project/ice.config.mts b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo_10-jsslot/expected/demo-project/ice.config.mts index e1d8a28141..84a44ccd62 100644 --- a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo_10-jsslot/expected/demo-project/ice.config.mts +++ b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo_10-jsslot/expected/demo-project/ice.config.mts @@ -77,7 +77,7 @@ export default defineConfig(() => ({ 'react-dom/client': 'ReactDOM', '@alifd/next': 'Next', lodash: 'var window._', - '@alilc/lowcode-engine': 'var window.AliLowCodeEngine', + '@felce/lowcode-engine': 'var window.AliLowCodeEngine', }, plugins: [ fusion({ @@ -87,4 +87,3 @@ export default defineConfig(() => ({ plugin(), ], })); - diff --git a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo_11-jsslot-2/expected/demo-project/ice.config.mts b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo_11-jsslot-2/expected/demo-project/ice.config.mts index e1d8a28141..84a44ccd62 100644 --- a/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo_11-jsslot-2/expected/demo-project/ice.config.mts +++ b/modules/code-generator/tests/fixtures/test-cases/icejs3-app/demo_11-jsslot-2/expected/demo-project/ice.config.mts @@ -77,7 +77,7 @@ export default defineConfig(() => ({ 'react-dom/client': 'ReactDOM', '@alifd/next': 'Next', lodash: 'var window._', - '@alilc/lowcode-engine': 'var window.AliLowCodeEngine', + '@felce/lowcode-engine': 'var window.AliLowCodeEngine', }, plugins: [ fusion({ @@ -87,4 +87,3 @@ export default defineConfig(() => ({ plugin(), ], })); - diff --git a/modules/code-generator/tests/public/SchemaParser/p0-basic.test.ts b/modules/code-generator/tests/public/SchemaParser/p0-basic.test.ts index 311b93c6b2..31939f6d33 100644 --- a/modules/code-generator/tests/public/SchemaParser/p0-basic.test.ts +++ b/modules/code-generator/tests/public/SchemaParser/p0-basic.test.ts @@ -1,4 +1,4 @@ -import { IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import { IPublicTypeProjectSchema } from '@felce/lowcode-types'; import { SchemaParser } from '../../../src'; import SCHEMA_WITH_SLOT from './data/schema-with-slot.json'; diff --git a/modules/code-generator/tests/public/publisher/disk/disk.test.ts b/modules/code-generator/tests/public/publisher/disk/disk.test.ts index a654a8a63b..9c8bfbaf8c 100644 --- a/modules/code-generator/tests/public/publisher/disk/disk.test.ts +++ b/modules/code-generator/tests/public/publisher/disk/disk.test.ts @@ -1,5 +1,5 @@ import CodeGen from '../../../../src'; -import { ResultDir } from '@alilc/lowcode-types'; +import { ResultDir } from '@felce/lowcode-types'; describe('public/publisher/disk/disk', () => { // standalone 模式下没有 disk publisher diff --git a/modules/code-generator/tests/public/solutions/icejs3-app.test.ts b/modules/code-generator/tests/public/solutions/icejs3-app.test.ts index 3d3ec4eac6..a38865d79f 100644 --- a/modules/code-generator/tests/public/solutions/icejs3-app.test.ts +++ b/modules/code-generator/tests/public/solutions/icejs3-app.test.ts @@ -12,7 +12,7 @@ import { import CodeGenerator from '../../../src'; -import type { IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import type { IPublicTypeProjectSchema } from '@felce/lowcode-types'; jest.setTimeout(15 * 1000); @@ -49,7 +49,11 @@ function defineTest(caseDirName: string) { }); } -async function exportProject(schemaJson: IPublicTypeProjectSchema, targetPath: string, projectName: string) { +async function exportProject( + schemaJson: IPublicTypeProjectSchema, + targetPath: string, + projectName: string, +) { const icejs3AppBuilder = CodeGenerator.solutions.icejs3(); const result = await icejs3AppBuilder.generateProject(schemaJson); diff --git a/modules/code-generator/tests/public/solutions/rax-app.test.ts b/modules/code-generator/tests/public/solutions/rax-app.test.ts index 320daf6daa..130c2dce23 100644 --- a/modules/code-generator/tests/public/solutions/rax-app.test.ts +++ b/modules/code-generator/tests/public/solutions/rax-app.test.ts @@ -13,7 +13,7 @@ import { import CodeGenerator from '../../../src'; -import type { IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import type { IPublicTypeProjectSchema } from '@felce/lowcode-types'; jest.setTimeout(15 * 1000); @@ -50,7 +50,11 @@ function defineTest(caseDirName: string) { }); } -async function exportProject(schemaJson: IPublicTypeProjectSchema, targetPath: string, projectName: string) { +async function exportProject( + schemaJson: IPublicTypeProjectSchema, + targetPath: string, + projectName: string, +) { const raxAppBuilder = CodeGenerator.solutions.rax(); const result = await raxAppBuilder.generateProject(schemaJson); diff --git a/modules/code-generator/tests/public/solutions/react-app.test.ts b/modules/code-generator/tests/public/solutions/react-app.test.ts index f70f10af09..333d91b3d4 100644 --- a/modules/code-generator/tests/public/solutions/react-app.test.ts +++ b/modules/code-generator/tests/public/solutions/react-app.test.ts @@ -12,7 +12,7 @@ import { import CodeGenerator from '../../../src'; -import type { IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import type { IPublicTypeProjectSchema } from '@felce/lowcode-types'; jest.setTimeout(15 * 1000); @@ -49,7 +49,11 @@ function defineTest(caseDirName: string) { }); } -async function exportProject(schemaJson: IPublicTypeProjectSchema, targetPath: string, projectName: string) { +async function exportProject( + schemaJson: IPublicTypeProjectSchema, + targetPath: string, + projectName: string, +) { const reactAppBuilder = CodeGenerator.solutions.icejs(); const result = await reactAppBuilder.generateProject(schemaJson); diff --git a/modules/code-generator/tests/utils/resultHelper/removeDirsFromResult.test.ts b/modules/code-generator/tests/utils/resultHelper/removeDirsFromResult.test.ts index 642ef4b18a..8c71e792c2 100644 --- a/modules/code-generator/tests/utils/resultHelper/removeDirsFromResult.test.ts +++ b/modules/code-generator/tests/utils/resultHelper/removeDirsFromResult.test.ts @@ -1,4 +1,4 @@ -import type { ResultDir } from '@alilc/lowcode-types'; +import type { ResultDir } from '@felce/lowcode-types'; import _ from 'lodash'; import CodeGen from '../../../src'; diff --git a/modules/code-generator/tests/utils/resultHelper/removeFilesFromResult.test.ts b/modules/code-generator/tests/utils/resultHelper/removeFilesFromResult.test.ts index d34964f37b..30a0451e96 100644 --- a/modules/code-generator/tests/utils/resultHelper/removeFilesFromResult.test.ts +++ b/modules/code-generator/tests/utils/resultHelper/removeFilesFromResult.test.ts @@ -1,4 +1,4 @@ -import type { ResultDir } from '@alilc/lowcode-types'; +import type { ResultDir } from '@felce/lowcode-types'; import _ from 'lodash'; import CodeGen from '../../../src'; diff --git a/modules/code-generator/tests/utils/schema/handleSubNodes.test.ts b/modules/code-generator/tests/utils/schema/handleSubNodes.test.ts index d88ecdf549..8afe814afc 100644 --- a/modules/code-generator/tests/utils/schema/handleSubNodes.test.ts +++ b/modules/code-generator/tests/utils/schema/handleSubNodes.test.ts @@ -1,4 +1,4 @@ -import { IPublicTypeNodeData } from '@alilc/lowcode-types'; +import { IPublicTypeNodeData } from '@felce/lowcode-types'; import { handleSubNodes } from '../../../src/utils/schema'; import SCHEMA_WITH_SLOT from './data/schema-with-slot.json'; diff --git a/modules/material-parser/README.md b/modules/material-parser/README.md index 0d3f5555d5..777d10b5d2 100644 --- a/modules/material-parser/README.md +++ b/modules/material-parser/README.md @@ -1,4 +1,4 @@ -# @alilc/lowcode-material-parser +# @felce/lowcode-material-parser > 入料模块 diff --git a/modules/material-parser/package.json b/modules/material-parser/package.json index 8b68c02955..73a8e0eabe 100644 --- a/modules/material-parser/package.json +++ b/modules/material-parser/package.json @@ -1,5 +1,5 @@ { - "name": "@alilc/lowcode-material-parser", + "name": "@felce/lowcode-material-parser", "version": "1.0.3", "description": "material parser for Ali lowCode engine", "main": "lib/index.js", @@ -69,8 +69,8 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/modules/material-parser" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/modules/material-parser" }, - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/package.json b/package.json index 213bbc1c45..279400551f 100644 --- a/package.json +++ b/package.json @@ -44,30 +44,24 @@ } }, "devDependencies": { + "@alilc/build-plugin-lce": "^0.0.5", + "@alilc/lowcode-test-mate": "^1.0.1", + "@babel/plugin-proposal-decorators": "^7.24.7", + "@types/react-router": "5.1.18", + "babel-jest": "^26.5.2", "del": "^6.1.1", "execa": "^5.1.1", - "f2elint": "^2.0.1", + "f2elint": "^4.8.0", "gulp": "^4.0.2", "husky": "^7.0.4", "lerna": "^4.0.0", - "typescript": "4.6.2", - "yarn": "^1.22.17", "rimraf": "^3.0.2", - "@types/react-router": "5.1.18", - "@alilc/build-plugin-lce": "^0.0.5", - "babel-jest": "^26.5.2", - "@alilc/lowcode-test-mate": "^1.0.1" - }, - "engines": { - "node": ">=14.17.0 <18" - }, - "tnpm": { - "mode": "yarn", - "lockfile": "enable" + "typescript": "4.6.2", + "yarn": "^1.22.17" }, "resolutions": { "typescript": "4.6.2", "react-error-overlay": "6.0.9" }, - "repository": "git@github.com:alibaba/lowcode-engine.git" + "repository": "git@github.com:fe-lce/lowcode-engine.git" } diff --git a/packages/designer/jest.config.js b/packages/designer/jest.config.js index 3684a48acb..f24656bbf8 100644 --- a/packages/designer/jest.config.js +++ b/packages/designer/jest.config.js @@ -1,7 +1,7 @@ const fs = require('fs'); const { join } = require('path'); const esModules = [].join('|'); -const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.')); +const pkgNames = fs.readdirSync(join('..')).filter((pkgName) => !pkgName.startsWith('.')); const jestConfig = { // transform: { @@ -22,9 +22,7 @@ const jestConfig = { // testMatch: ['**/selection.test.ts'], // testMatch: ['**/plugin/sequencify.test.ts'], // testMatch: ['**/builtin-simulator/utils/parse-metadata.test.ts'], - transformIgnorePatterns: [ - `/node_modules/(?!${esModules})/`, - ], + transformIgnorePatterns: [`/node_modules/(?!${esModules})/`], setupFiles: ['./tests/fixtures/unhandled-rejection.ts'], moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], collectCoverage: false, @@ -49,6 +47,6 @@ const jestConfig = { // 只对本仓库内的 pkg 做 mapping jestConfig.moduleNameMapper = {}; -jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '/../$1/src'; +jestConfig.moduleNameMapper[`^@felce/lowcode\\-(${pkgNames.join('|')})$`] = '/../$1/src'; -module.exports = jestConfig; \ No newline at end of file +module.exports = jestConfig; diff --git a/packages/designer/package.json b/packages/designer/package.json index 97256d3a21..563e3d2979 100644 --- a/packages/designer/package.json +++ b/packages/designer/package.json @@ -1,6 +1,6 @@ { - "name": "@alilc/lowcode-designer", - "version": "1.3.2", + "name": "@felce/lowcode-designer", + "version": "1.4.0", "description": "Designer for Ali LowCode Engine", "main": "lib/index.js", "module": "es/index.js", @@ -15,9 +15,9 @@ }, "license": "MIT", "dependencies": { - "@alilc/lowcode-editor-core": "1.3.2", - "@alilc/lowcode-types": "1.3.2", - "@alilc/lowcode-utils": "1.3.2", + "@felce/lowcode-editor-core": "1.4.0", + "@felce/lowcode-types": "1.4.0", + "@felce/lowcode-utils": "1.4.0", "classnames": "^2.2.6", "react": "^16", "react-dom": "^16.7.0", @@ -50,9 +50,9 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/designer" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/packages/designer" }, "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/packages/designer/src/builtin-simulator/bem-tools/border-container.tsx b/packages/designer/src/builtin-simulator/bem-tools/border-container.tsx index 212cb80bbd..b706b0aa3e 100644 --- a/packages/designer/src/builtin-simulator/bem-tools/border-container.tsx +++ b/packages/designer/src/builtin-simulator/bem-tools/border-container.tsx @@ -1,9 +1,9 @@ import * as React from 'react'; import { Component, Fragment, ReactElement, PureComponent } from 'react'; import classNames from 'classnames'; -import { computed, observer, Title, globalLocale } from '@alilc/lowcode-editor-core'; -import { IPublicTypeI18nData, IPublicTypeTitleContent } from '@alilc/lowcode-types'; -import { isI18nData } from '@alilc/lowcode-utils'; +import { computed, observer, Title, globalLocale } from '@felce/lowcode-editor-core'; +import { IPublicTypeI18nData, IPublicTypeTitleContent } from '@felce/lowcode-types'; +import { isI18nData } from '@felce/lowcode-utils'; import { DropLocation } from '../../designer'; import { BuiltinSimulatorHost } from '../../builtin-simulator/host'; import { INode } from '../../document/node'; @@ -47,11 +47,14 @@ function getTitle(title: string | IPublicTypeI18nData | ReactElement) { } @observer -export class BorderContainer extends Component<{ - host: BuiltinSimulatorHost; -}, { - target?: INode; -}> { +export class BorderContainer extends Component< + { + host: BuiltinSimulatorHost; + }, + { + target?: INode; + } +> { state = {} as any; @computed get scale() { diff --git a/packages/designer/src/builtin-simulator/bem-tools/border-detecting.tsx b/packages/designer/src/builtin-simulator/bem-tools/border-detecting.tsx index 49e68b77c8..4f8259c775 100644 --- a/packages/designer/src/builtin-simulator/bem-tools/border-detecting.tsx +++ b/packages/designer/src/builtin-simulator/bem-tools/border-detecting.tsx @@ -1,8 +1,8 @@ import { Component, Fragment, PureComponent } from 'react'; import classNames from 'classnames'; -import { computed, observer, Title } from '@alilc/lowcode-editor-core'; -import { IPublicTypeTitleContent } from '@alilc/lowcode-types'; -import { getClosestNode } from '@alilc/lowcode-utils'; +import { computed, observer, Title } from '@felce/lowcode-editor-core'; +import { IPublicTypeTitleContent } from '@felce/lowcode-types'; +import { getClosestNode } from '@felce/lowcode-utils'; import { intl } from '../../locale'; import { BuiltinSimulatorHost } from '../host'; @@ -35,9 +35,7 @@ export class BorderDetectingInstance extends PureComponent<{ return (
- { - isLocked ? (<Title title={intl('locked')} className="lc-borders-status" />) : null - } + {isLocked ? <Title title={intl('locked')} className="lc-borders-status" /> : null} </div> ); } @@ -77,7 +75,10 @@ export class BorderDetecting extends Component<{ host: BuiltinSimulatorHost }> { const { current } = this; const canHoverHook = current?.componentMeta.advanced.callbacks?.onHoverHook; - const canHover = (canHoverHook && typeof canHoverHook === 'function') ? canHoverHook(current.internalToShellNode()) : true; + const canHover = + canHoverHook && typeof canHoverHook === 'function' + ? canHoverHook(current.internalToShellNode()) + : true; if (!canHover || !current || host.viewport.scrolling || host.liveEditing.editing) { return null; @@ -118,7 +119,10 @@ export class BorderDetecting extends Component<{ host: BuiltinSimulatorHost }> { scrollX={this.scrollX} scrollY={this.scrollY} // @ts-ignore - rect={host.computeComponentInstanceRect(host.getComponentInstances(lockedNode)[0], lockedNode.componentMeta.rootSelector)} + rect={host.computeComponentInstanceRect( + host.getComponentInstances(lockedNode)[0], + lockedNode.componentMeta.rootSelector, + )} isLocked={lockedNode?.getId() !== current.getId()} /> ); diff --git a/packages/designer/src/builtin-simulator/bem-tools/border-resizing.tsx b/packages/designer/src/builtin-simulator/bem-tools/border-resizing.tsx index 4b3c5c31a9..0137fde1d6 100644 --- a/packages/designer/src/builtin-simulator/bem-tools/border-resizing.tsx +++ b/packages/designer/src/builtin-simulator/bem-tools/border-resizing.tsx @@ -1,6 +1,6 @@ import React, { Component, Fragment } from 'react'; import DragResizeEngine from './drag-resize-engine'; -import { observer, computed } from '@alilc/lowcode-editor-core'; +import { observer, computed } from '@felce/lowcode-editor-core'; import classNames from 'classnames'; import { SimulatorContext } from '../context'; import { BuiltinSimulatorHost } from '../host'; @@ -89,7 +89,12 @@ export class BoxResizingForNode extends Component<{ host: BuiltinSimulatorHost; return null; } return ( - <BoxResizingInstance key={observed.id} dragging={this.dragging} designer={designer} observed={observed} /> + <BoxResizingInstance + key={observed.id} + dragging={this.dragging} + designer={designer} + observed={observed} + /> ); })} </Fragment> @@ -135,12 +140,15 @@ export class BoxResizingInstance extends Component<{ // this.hoveringCapture.setBoundary(this.outline); this.willBind(); - const resize = (e: MouseEvent, direction: string, node: INode, moveX: number, moveY: number) => { + const resize = ( + e: MouseEvent, + direction: string, + node: INode, + moveX: number, + moveY: number, + ) => { const { advanced } = node.componentMeta; - if ( - advanced.callbacks && - typeof advanced.callbacks.onResize === 'function' - ) { + if (advanced.callbacks && typeof advanced.callbacks.onResize === 'function') { (e as any).trigger = direction; (e as any).deltaX = moveX; (e as any).deltaY = moveY; @@ -151,10 +159,7 @@ export class BoxResizingInstance extends Component<{ const resizeStart = (e: MouseEvent, direction: string, node: INode) => { const { advanced } = node.componentMeta; - if ( - advanced.callbacks && - typeof advanced.callbacks.onResizeStart === 'function' - ) { + if (advanced.callbacks && typeof advanced.callbacks.onResizeStart === 'function') { (e as any).trigger = direction; const cbNode = node?.isNode ? node.internalToShellNode() : node; advanced.callbacks.onResizeStart(e, cbNode); @@ -163,10 +168,7 @@ export class BoxResizingInstance extends Component<{ const resizeEnd = (e: MouseEvent, direction: string, node: INode) => { const { advanced } = node.componentMeta; - if ( - advanced.callbacks && - typeof advanced.callbacks.onResizeEnd === 'function' - ) { + if (advanced.callbacks && typeof advanced.callbacks.onResizeEnd === 'function') { (e as any).trigger = direction; const cbNode = node?.isNode ? node.internalToShellNode() : node; advanced.callbacks.onResizeEnd(e, cbNode); @@ -248,7 +250,9 @@ export class BoxResizingInstance extends Component<{ const { node } = observed; const metadata = node.componentMeta.getMetadata(); if (metadata.configure?.advanced?.getResizingHandlers) { - triggerVisible = metadata.configure.advanced.getResizingHandlers(node.internalToShellNode()); + triggerVisible = metadata.configure.advanced.getResizingHandlers( + node.internalToShellNode(), + ); } } triggerVisible = normalizeTriggers(triggerVisible); diff --git a/packages/designer/src/builtin-simulator/bem-tools/border-selecting.tsx b/packages/designer/src/builtin-simulator/bem-tools/border-selecting.tsx index 143c67e020..4609458247 100644 --- a/packages/designer/src/builtin-simulator/bem-tools/border-selecting.tsx +++ b/packages/designer/src/builtin-simulator/bem-tools/border-selecting.tsx @@ -9,9 +9,9 @@ import { ComponentType, } from 'react'; import classNames from 'classnames'; -import { observer, computed, Tip, engineConfig } from '@alilc/lowcode-editor-core'; -import { createIcon, isReactComponent, isActionContentObject } from '@alilc/lowcode-utils'; -import { IPublicTypeActionContentObject } from '@alilc/lowcode-types'; +import { observer, computed, Tip, engineConfig } from '@felce/lowcode-editor-core'; +import { createIcon, isReactComponent, isActionContentObject } from '@felce/lowcode-utils'; +import { IPublicTypeActionContentObject } from '@felce/lowcode-types'; import { BuiltinSimulatorHost } from '../host'; import { INode, OffsetObserver } from '../../designer'; import NodeSelector from '../node-selector'; @@ -54,11 +54,8 @@ export class BorderSelectingInstance extends Component<{ } return ( - <div - className={className} - style={style} - > - {(!dragging && !hideComponentAction) ? <Toolbar observed={observed} /> : null} + <div className={className} style={style}> + {!dragging && !hideComponentAction ? <Toolbar observed={observed} /> : null} </div> ); } @@ -107,7 +104,10 @@ class Toolbar extends Component<{ observed: OffsetObserver }> { // FIXME: need this? return; } - if (important && (typeof condition === 'function' ? condition(node) !== false : condition !== false)) { + if ( + important && + (typeof condition === 'function' ? condition(node) !== false : condition !== false) + ) { actions.push(createAction(content, name, node)); } }); @@ -120,7 +120,11 @@ class Toolbar extends Component<{ observed: OffsetObserver }> { } } -function createAction(content: ReactNode | ComponentType<any> | IPublicTypeActionContentObject, key: string, node: INode) { +function createAction( + content: ReactNode | ComponentType<any> | IPublicTypeActionContentObject, + key: string, + node: INode, +) { if (isValidElement<{ key: string; node: INode }>(content)) { return cloneElement(content, { key, node }); } @@ -187,7 +191,13 @@ export class BorderSelectingForNode extends Component<{ host: ISimulatorHost; no if (!observed) { return null; } - return <BorderSelectingInstance key={observed.id} dragging={this.dragging} observed={observed} />; + return ( + <BorderSelectingInstance + key={observed.id} + dragging={this.dragging} + observed={observed} + /> + ); })} </Fragment> ); diff --git a/packages/designer/src/builtin-simulator/bem-tools/drag-resize-engine.ts b/packages/designer/src/builtin-simulator/bem-tools/drag-resize-engine.ts index 6689379dde..3d30e4a1a3 100644 --- a/packages/designer/src/builtin-simulator/bem-tools/drag-resize-engine.ts +++ b/packages/designer/src/builtin-simulator/bem-tools/drag-resize-engine.ts @@ -1,8 +1,8 @@ import { ISimulatorHost } from '../../simulator'; import { Designer, Point } from '../../designer'; -import { cursor } from '@alilc/lowcode-utils'; +import { cursor } from '@felce/lowcode-utils'; import { makeEventsHandler } from '../../utils/misc'; -import { createModuleEventBus, IEventBus } from '@alilc/lowcode-editor-core'; +import { createModuleEventBus, IEventBus } from '@felce/lowcode-editor-core'; // 拖动缩放 export default class DragResizeEngine { @@ -52,7 +52,7 @@ export default class DragResizeEngine { if (!sourceDocument || sourceDocument === document) { return e; } - const srcSim = masterSensors.find(sim => sim.contentDocument === sourceDocument); + const srcSim = masterSensors.find((sim) => sim.contentDocument === sourceDocument); if (srcSim) { return srcSim.viewport.toGlobalPoint(e); } @@ -61,7 +61,7 @@ export default class DragResizeEngine { const over = (e: MouseEvent) => { const handleEvents = makeEventsHandler(e, masterSensors); - handleEvents(doc => { + handleEvents((doc) => { doc.removeEventListener('mousemove', move, true); doc.removeEventListener('mouseup', over, true); }); @@ -77,7 +77,7 @@ export default class DragResizeEngine { node = boost(e); startEvent = createResizeEvent(e); const handleEvents = makeEventsHandler(e, masterSensors); - handleEvents(doc => { + handleEvents((doc) => { doc.addEventListener('mousemove', move, true); doc.addEventListener('mouseup', over, true); }); @@ -118,7 +118,7 @@ export default class DragResizeEngine { private getMasterSensors(): ISimulatorHost[] { return this.designer.project.documents - .map(doc => { + .map((doc) => { if (doc.active && doc.simulator?.sensorAvailable) { return doc.simulator; } diff --git a/packages/designer/src/builtin-simulator/bem-tools/index.tsx b/packages/designer/src/builtin-simulator/bem-tools/index.tsx index bc485af1b4..2895b36351 100644 --- a/packages/designer/src/builtin-simulator/bem-tools/index.tsx +++ b/packages/designer/src/builtin-simulator/bem-tools/index.tsx @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import { observer, engineConfig } from '@alilc/lowcode-editor-core'; +import { observer, engineConfig } from '@felce/lowcode-editor-core'; import { BorderDetecting } from './border-detecting'; import { BorderContainer } from './border-container'; import { BuiltinSimulatorHost } from '../host'; @@ -19,19 +19,22 @@ export class BemTools extends Component<{ host: BuiltinSimulatorHost }> { return null; } return ( - <div className="lc-bem-tools" style={{ transform: `translate(${-scrollX * scale}px,${-scrollY * scale}px)` }}> - { !engineConfig.get('disableDetecting') && <BorderDetecting key="hovering" host={host} /> } + <div + className="lc-bem-tools" + style={{ transform: `translate(${-scrollX * scale}px,${-scrollY * scale}px)` }} + > + {!engineConfig.get('disableDetecting') && <BorderDetecting key="hovering" host={host} />} <BorderSelecting key="selecting" host={host} /> - { engineConfig.get('enableReactiveContainer') && <BorderContainer key="reactive-container-border" host={host} /> } + {engineConfig.get('enableReactiveContainer') && ( + <BorderContainer key="reactive-container-border" host={host} /> + )} <InsertionView key="insertion" host={host} /> <BorderResizing key="resizing" host={host} /> - { - host.designer.bemToolsManager.getAllBemTools().map(tools => { - const ToolsCls = tools.item; - return <ToolsCls key={tools.name} host={host} />; - }) - } + {host.designer.bemToolsManager.getAllBemTools().map((tools) => { + const ToolsCls = tools.item; + return <ToolsCls key={tools.name} host={host} />; + })} </div> ); } -} \ No newline at end of file +} diff --git a/packages/designer/src/builtin-simulator/bem-tools/insertion.tsx b/packages/designer/src/builtin-simulator/bem-tools/insertion.tsx index 98ac4266cc..0adf128fe3 100644 --- a/packages/designer/src/builtin-simulator/bem-tools/insertion.tsx +++ b/packages/designer/src/builtin-simulator/bem-tools/insertion.tsx @@ -1,15 +1,17 @@ import { Component } from 'react'; -import { observer } from '@alilc/lowcode-editor-core'; +import { observer } from '@felce/lowcode-editor-core'; import { BuiltinSimulatorHost } from '../host'; -import { - DropLocation, - isVertical, -} from '../../designer'; +import { DropLocation, isVertical } from '../../designer'; import { ISimulatorHost } from '../../simulator'; import { INode } from '../../document'; import './insertion.less'; -import { IPublicTypeNodeData, IPublicTypeNodeSchema, IPublicTypeLocationChildrenDetail, IPublicTypeRect } from '@alilc/lowcode-types'; -import { isLocationChildrenDetail } from '@alilc/lowcode-utils'; +import { + IPublicTypeNodeData, + IPublicTypeNodeSchema, + IPublicTypeLocationChildrenDetail, + IPublicTypeRect, +} from '@felce/lowcode-types'; +import { isLocationChildrenDetail } from '@felce/lowcode-utils'; interface InsertionData { edge?: DOMRect; @@ -23,7 +25,11 @@ interface InsertionData { /** * 处理拖拽子节点(INode)情况 */ -function processChildrenDetail(sim: ISimulatorHost, container: INode, detail: IPublicTypeLocationChildrenDetail): InsertionData { +function processChildrenDetail( + sim: ISimulatorHost, + container: INode, + detail: IPublicTypeLocationChildrenDetail, +): InsertionData { let edge = detail.edge || null; if (!edge) { diff --git a/packages/designer/src/builtin-simulator/create-simulator.ts b/packages/designer/src/builtin-simulator/create-simulator.ts index 57369efd89..13c811fadb 100644 --- a/packages/designer/src/builtin-simulator/create-simulator.ts +++ b/packages/designer/src/builtin-simulator/create-simulator.ts @@ -9,7 +9,7 @@ import { AssetType, assetItem, isCSSUrl, -} from '@alilc/lowcode-utils'; +} from '@felce/lowcode-utils'; import { BuiltinSimulatorRenderer } from './renderer'; @@ -58,19 +58,13 @@ export function createSimulator( const lv = asset.level || level || AssetLevel.Environment; const scriptType = asset.scriptType ? ` type="${asset.scriptType}"` : ''; if (asset.type === AssetType.JSUrl) { - scripts[lv].push( - `<script src="${asset.content}"${id}${scriptType}></script>`, - ); + scripts[lv].push(`<script src="${asset.content}"${id}${scriptType}></script>`); } else if (asset.type === AssetType.JSText) { scripts[lv].push(`<script${id}${scriptType}>${asset.content}</script>`); } else if (asset.type === AssetType.CSSUrl) { - styles[lv].push( - `<link rel="stylesheet" href="${asset.content}"${id} />`, - ); + styles[lv].push(`<link rel="stylesheet" href="${asset.content}"${id} />`); } else if (asset.type === AssetType.CSSText) { - styles[lv].push( - `<style type="text/css"${id}>${asset.content}</style>`, - ); + styles[lv].push(`<style type="text/css"${id}>${asset.content}</style>`); } } } diff --git a/packages/designer/src/builtin-simulator/host-view.tsx b/packages/designer/src/builtin-simulator/host-view.tsx index 21e0079306..355f687816 100644 --- a/packages/designer/src/builtin-simulator/host-view.tsx +++ b/packages/designer/src/builtin-simulator/host-view.tsx @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import { observer } from '@alilc/lowcode-editor-core'; +import { observer } from '@felce/lowcode-editor-core'; import { BuiltinSimulatorHost, BuiltinSimulatorProps } from './host'; import { BemTools } from './bem-tools'; import { Project } from '../project'; @@ -24,7 +24,8 @@ export class BuiltinSimulatorHostView extends Component<SimulatorHostProps> { constructor(props: any) { super(props); const { project, onMount, designer } = this.props; - this.host = (project.simulator as BuiltinSimulatorHost) || new BuiltinSimulatorHost(project, designer); + this.host = + (project.simulator as BuiltinSimulatorHost) || new BuiltinSimulatorHost(project, designer); this.host.setProps(this.props); onMount?.(this.host); } @@ -58,7 +59,11 @@ class Canvas extends Component<{ host: BuiltinSimulatorHost }> { return ( <div className={className} style={canvas}> - <div ref={(elmt) => sim.mountViewport(elmt)} className="lc-simulator-canvas-viewport" style={viewport}> + <div + ref={(elmt) => sim.mountViewport(elmt)} + className="lc-simulator-canvas-viewport" + style={viewport} + > <BemTools host={sim} /> <Content host={sim} /> </div> diff --git a/packages/designer/src/builtin-simulator/host.ts b/packages/designer/src/builtin-simulator/host.ts index 57f8569326..5dd2806443 100644 --- a/packages/designer/src/builtin-simulator/host.ts +++ b/packages/designer/src/builtin-simulator/host.ts @@ -12,13 +12,9 @@ import { makeObservable, createModuleEventBus, IEventBus, -} from '@alilc/lowcode-editor-core'; +} from '@felce/lowcode-editor-core'; -import { - ISimulatorHost, - Component, - DropContainer, -} from '../simulator'; +import { ISimulatorHost, Component, DropContainer } from '../simulator'; import Viewport from './viewport'; import { createSimulator } from './create-simulator'; import { Node, INode, contains, isRootNode, isLowCodeComponent } from '../document'; @@ -40,7 +36,7 @@ import { isDragNodeObject, isLocationData, Logger, -} from '@alilc/lowcode-utils'; +} from '@felce/lowcode-utils'; import { isShaken, ILocateEvent, @@ -64,7 +60,7 @@ import { IPublicTypeLocationDetailType, IPublicTypeRect, IPublicModelNode, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { BuiltinSimulatorRenderer } from './renderer'; import { clipboard } from '../designer/clipboard'; import { LiveEditing } from './live-editing/live-editing'; @@ -352,24 +348,30 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp */ connect( renderer: BuiltinSimulatorRenderer, - effect: (reaction: IReactionPublic) => void, options?: IReactionOptions, + effect: (reaction: IReactionPublic) => void, + options?: IReactionOptions, ) { this._renderer = renderer; return autorun(effect, options); } - reaction(expression: (reaction: IReactionPublic) => unknown, effect: (value: unknown, prev: unknown, reaction: IReactionPublic) => void, - opts?: IReactionOptions | undefined): IReactionDisposer { + reaction( + expression: (reaction: IReactionPublic) => unknown, + effect: (value: unknown, prev: unknown, reaction: IReactionPublic) => void, + opts?: IReactionOptions | undefined, + ): IReactionDisposer { return reaction(expression, effect, opts); } - autorun(effect: (reaction: IReactionPublic) => void, options?: IReactionOptions): IReactionDisposer { + autorun( + effect: (reaction: IReactionPublic) => void, + options?: IReactionOptions, + ): IReactionDisposer { return autorun(effect, options); } purge(): void { // todo - } mountViewport(viewport: HTMLElement | null) { @@ -450,11 +452,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp const vendors = [ // required & use once - assetBundle( - this.get('environment') || - defaultEnvironment, - AssetLevel.Environment, - ), + assetBundle(this.get('environment') || defaultEnvironment, AssetLevel.Environment), // required & use once assetBundle(this.get('extraEnvironment'), AssetLevel.Environment), @@ -463,11 +461,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp // required & TODO: think of update assetBundle(this.theme, AssetLevel.Theme), // required & use once - assetBundle( - this.get('simulatorUrl') || - defaultSimulatorUrl, - AssetLevel.Runtime, - ), + assetBundle(this.get('simulatorUrl') || defaultSimulatorUrl, AssetLevel.Runtime), ]; // wait 准备 iframe 内容、依赖库注入 @@ -697,10 +691,14 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp '.next-calendar-table', '.editor-container', // 富文本组件 ]; - const ignoreSelectors = customizeIgnoreSelectors?.(defaultIgnoreSelectors, e) || defaultIgnoreSelectors; + const ignoreSelectors = + customizeIgnoreSelectors?.(defaultIgnoreSelectors, e) || defaultIgnoreSelectors; const ignoreSelectorsString = ignoreSelectors.join(','); // 提供了 customizeIgnoreSelectors 的情况下,忽略 isFormEvent() 判断 - if ((!customizeIgnoreSelectors && isFormEvent(e)) || target?.closest(ignoreSelectorsString)) { + if ( + (!customizeIgnoreSelectors && isFormEvent(e)) || + target?.closest(ignoreSelectorsString) + ) { e.preventDefault(); e.stopPropagation(); } @@ -918,7 +916,10 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp /** * @see ISimulator */ - getComponentInstances(node: INode, context?: IPublicTypeNodeInstance): IPublicTypeComponentInstance[] | null { + getComponentInstances( + node: INode, + context?: IPublicTypeNodeInstance, + ): IPublicTypeComponentInstance[] | null { const docId = node.document?.id; if (!docId) { return null; @@ -966,7 +967,10 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp /** * @see ISimulator */ - computeComponentInstanceRect(instance: IPublicTypeComponentInstance, selector?: string): IPublicTypeRect | null { + computeComponentInstanceRect( + instance: IPublicTypeComponentInstance, + selector?: string, + ): IPublicTypeRect | null { const renderer = this.renderer!; const elements = this.findDOMNodes(instance, selector); if (!elements) { @@ -1032,7 +1036,10 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp /** * @see ISimulator */ - findDOMNodes(instance: IPublicTypeComponentInstance, selector?: string): Array<Element | Text> | null { + findDOMNodes( + instance: IPublicTypeComponentInstance, + selector?: string, + ): Array<Element | Text> | null { const elements = this._renderer?.findDOMNodes(instance); if (!elements) { return null; @@ -1051,7 +1058,9 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp /** * 通过 DOM 节点获取节点,依赖 simulator 的接口 */ - getNodeInstanceFromElement(target: Element | null): IPublicTypeNodeInstance<IPublicTypeComponentInstance, INode> | null { + getNodeInstanceFromElement( + target: Element | null, + ): IPublicTypeNodeInstance<IPublicTypeComponentInstance, INode> | null { if (!target) { return null; } @@ -1193,7 +1202,10 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp const operationalNodes = nodes?.filter((node) => { const onMoveHook = node.componentMeta?.advanced.callbacks?.onMoveHook; - const canMove = onMoveHook && typeof onMoveHook === 'function' ? onMoveHook(node.internalToShellNode()) : true; + const canMove = + onMoveHook && typeof onMoveHook === 'function' + ? onMoveHook(node.internalToShellNode()) + : true; let parentContainerNode: INode | null = null; let parentNode = node.parent; @@ -1207,9 +1219,13 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp parentNode = parentNode.parent; } - const onChildMoveHook = parentContainerNode?.componentMeta?.advanced.callbacks?.onChildMoveHook; + const onChildMoveHook = + parentContainerNode?.componentMeta?.advanced.callbacks?.onChildMoveHook; - const childrenCanMove = onChildMoveHook && parentContainerNode && typeof onChildMoveHook === 'function' ? onChildMoveHook(node.internalToShellNode(), parentContainerNode.internalToShellNode()) : true; + const childrenCanMove = + onChildMoveHook && parentContainerNode && typeof onChildMoveHook === 'function' + ? onChildMoveHook(node.internalToShellNode(), parentContainerNode.internalToShellNode()) + : true; return canMove && childrenCanMove; }); @@ -1227,9 +1243,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp const dropContainer = this.getDropContainer(e); const lockedNode = getClosestNode(dropContainer?.container, (node) => node.isLocked); if (lockedNode) return null; - if ( - !dropContainer - ) { + if (!dropContainer) { return null; } @@ -1296,8 +1310,9 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp const inst = instances ? instances.length > 1 ? instances.find( - (_inst) => this.getClosestNodeInstance(_inst, container.id)?.instance === containerInstance, - ) + (_inst) => + this.getClosestNodeInstance(_inst, container.id)?.instance === containerInstance, + ) : instances[0] : null; const rect = inst @@ -1514,10 +1529,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp /** * 查找邻近容器 */ - getNearByContainer( - { container, instance }: DropContainer, - drillDownExcludes: Set<INode>, - ) { + getNearByContainer({ container, instance }: DropContainer, drillDownExcludes: Set<INode>) { const { children } = container; if (!children || children.isEmpty()) { return null; diff --git a/packages/designer/src/builtin-simulator/live-editing/live-editing.ts b/packages/designer/src/builtin-simulator/live-editing/live-editing.ts index c8594d701b..1ad475b14c 100644 --- a/packages/designer/src/builtin-simulator/live-editing/live-editing.ts +++ b/packages/designer/src/builtin-simulator/live-editing/live-editing.ts @@ -1,5 +1,5 @@ -import { obx } from '@alilc/lowcode-editor-core'; -import { IPublicTypePluginConfig, IPublicTypeLiveTextEditingConfig } from '@alilc/lowcode-types'; +import { obx } from '@felce/lowcode-editor-core'; +import { IPublicTypePluginConfig, IPublicTypeLiveTextEditingConfig } from '@felce/lowcode-types'; import { INode, Prop } from '../../document'; const EDITOR_KEY = 'data-setter-prop'; @@ -59,7 +59,9 @@ export class LiveEditing { const editor = node.document?.designer.editor; const npm = node?.componentMeta?.npm; const selected = - [npm?.package, npm?.componentName].filter((item) => !!item).join('-') || node?.componentMeta?.componentName || ''; + [npm?.package, npm?.componentName].filter((item) => !!item).join('-') || + node?.componentMeta?.componentName || + ''; editor?.eventBus.emit('designer.builtinSimulator.liveEditing', { selected, }); @@ -70,10 +72,10 @@ export class LiveEditing { if (liveTextEditing) { if (propTarget) { // 已埋点命中 data-setter-prop="proptarget", 从 liveTextEditing 读取配置(mode|onSaveContent) - matched = liveTextEditing.find(config => config.propTarget == propTarget); + matched = liveTextEditing.find((config) => config.propTarget == propTarget); } else { // 执行 embedTextEditing selector 规则,获得第一个节点 是否 contains e.target,若匹配,读取配置 - matched = liveTextEditing.find(config => { + matched = liveTextEditing.find((config) => { if (!config.selector) { return false; } @@ -89,7 +91,8 @@ export class LiveEditing { }); if (matched) { propTarget = matched.propTarget; - setterPropElement = matched.propElement || queryPropElement(rootElement, targetElement, matched.selector); + setterPropElement = + matched.propElement || queryPropElement(rootElement, targetElement, matched.selector); } } @@ -117,9 +120,15 @@ export class LiveEditing { // 4. 监听 blur 事件 // 5. 设置编辑锁定:disable hover | disable select | disable canvas drag - const onSaveContent = matched?.onSaveContent || saveHandlers.find(item => item.condition(prop))?.onSaveContent || defaultSaveContent; + const onSaveContent = + matched?.onSaveContent || + saveHandlers.find((item) => item.condition(prop))?.onSaveContent || + defaultSaveContent; - setterPropElement.setAttribute('contenteditable', matched?.mode && matched.mode !== 'plaintext' ? 'true' : 'plaintext-only'); + setterPropElement.setAttribute( + 'contenteditable', + matched?.mode && matched.mode !== 'plaintext' ? 'true' : 'plaintext-only', + ); setterPropElement.classList.add('engine-live-editing'); // be sure setterPropElement.focus(); @@ -134,7 +143,7 @@ export class LiveEditing { switch (e.code) { case 'Enter': break; - // TODO: check is richtext? + // TODO: check is richtext? case 'Escape': break; case 'Tab': @@ -186,9 +195,11 @@ export class LiveEditing { } } -export type SpecificRule = (target: EditingTarget) => (IPublicTypeLiveTextEditingConfig & { - propElement?: HTMLElement; -}) | null; +export type SpecificRule = (target: EditingTarget) => + | (IPublicTypeLiveTextEditingConfig & { + propElement?: HTMLElement; + }) + | null; export interface SaveHandler { condition: (prop: Prop) => boolean; @@ -223,7 +234,9 @@ function queryPropElement(rootElement: HTMLElement, targetElement: HTMLElement, } if (!propElement.contains(targetElement)) { // try selectorAll - propElement = Array.from(rootElement.querySelectorAll(selector)).find(item => item.contains(targetElement)) as HTMLElement; + propElement = Array.from(rootElement.querySelectorAll(selector)).find((item) => + item.contains(targetElement), + ) as HTMLElement; if (!propElement) { return null; } diff --git a/packages/designer/src/builtin-simulator/node-selector/index.tsx b/packages/designer/src/builtin-simulator/node-selector/index.tsx index 0723115da2..50be282ea9 100644 --- a/packages/designer/src/builtin-simulator/node-selector/index.tsx +++ b/packages/designer/src/builtin-simulator/node-selector/index.tsx @@ -1,10 +1,10 @@ import { Overlay } from '@alifd/next'; import React, { MouseEvent } from 'react'; -import { Title, observer } from '@alilc/lowcode-editor-core'; -import { canClickNode } from '@alilc/lowcode-utils'; +import { Title, observer } from '@felce/lowcode-editor-core'; +import { canClickNode } from '@felce/lowcode-utils'; import './index.less'; -import { INode } from '@alilc/lowcode-designer'; +import { INode } from '@felce/lowcode-designer'; const { Popup } = Overlay; @@ -80,17 +80,21 @@ export default class InstanceNodeSelector extends React.Component<IProps, IState } }; - onMouseOver = (node: INode) => (_: any, flag = true) => { - if (node && typeof node.hover === 'function') { - node.hover(flag); - } - }; + onMouseOver = + (node: INode) => + (_: any, flag = true) => { + if (node && typeof node.hover === 'function') { + node.hover(flag); + } + }; - onMouseOut = (node: INode) => (_: any, flag = false) => { - if (node && typeof node.hover === 'function') { - node.hover(flag); - } - }; + onMouseOut = + (node: INode) => + (_: any, flag = false) => { + if (node && typeof node.hover === 'function') { + node.hover(flag); + } + }; renderNodes = () => { const nodes = this.state.parentNodes; diff --git a/packages/designer/src/builtin-simulator/renderer.ts b/packages/designer/src/builtin-simulator/renderer.ts index 15664757bc..c45382da27 100644 --- a/packages/designer/src/builtin-simulator/renderer.ts +++ b/packages/designer/src/builtin-simulator/renderer.ts @@ -1,7 +1,10 @@ import { Component } from '../simulator'; -import { IPublicTypeComponentInstance, IPublicTypeSimulatorRenderer } from '@alilc/lowcode-types'; +import { IPublicTypeComponentInstance, IPublicTypeSimulatorRenderer } from '@felce/lowcode-types'; -export type BuiltinSimulatorRenderer = IPublicTypeSimulatorRenderer<Component, IPublicTypeComponentInstance>; +export type BuiltinSimulatorRenderer = IPublicTypeSimulatorRenderer< + Component, + IPublicTypeComponentInstance +>; export function isSimulatorRenderer(obj: any): obj is BuiltinSimulatorRenderer { return obj && obj.isSimulatorRenderer; diff --git a/packages/designer/src/builtin-simulator/resource-consumer.ts b/packages/designer/src/builtin-simulator/resource-consumer.ts index cc195e516f..288534309e 100644 --- a/packages/designer/src/builtin-simulator/resource-consumer.ts +++ b/packages/designer/src/builtin-simulator/resource-consumer.ts @@ -1,4 +1,10 @@ -import { autorun, makeObservable, obx, createModuleEventBus, IEventBus } from '@alilc/lowcode-editor-core'; +import { + autorun, + makeObservable, + obx, + createModuleEventBus, + IEventBus, +} from '@felce/lowcode-editor-core'; import { BuiltinSimulatorHost } from './host'; import { BuiltinSimulatorRenderer, isSimulatorRenderer } from './renderer'; @@ -31,7 +37,10 @@ export default class ResourceConsumer<T = any> { private resolveFirst?: (resolve?: any) => void; - constructor(provider: () => T, private consumer?: RendererConsumer<T>) { + constructor( + provider: () => T, + private consumer?: RendererConsumer<T>, + ) { makeObservable(this); this._providing = autorun(() => { this._data = provider(); diff --git a/packages/designer/src/builtin-simulator/utils/clickable.ts b/packages/designer/src/builtin-simulator/utils/clickable.ts index 5413ad5c52..873fab13fd 100644 --- a/packages/designer/src/builtin-simulator/utils/clickable.ts +++ b/packages/designer/src/builtin-simulator/utils/clickable.ts @@ -1,4 +1,4 @@ -import { getClosestNode, canClickNode } from '@alilc/lowcode-utils'; +import { getClosestNode, canClickNode } from '@felce/lowcode-utils'; import { INode } from '../../document'; /** diff --git a/packages/designer/src/builtin-simulator/utils/parse-metadata.ts b/packages/designer/src/builtin-simulator/utils/parse-metadata.ts index 6969a47db5..5c2646f83d 100644 --- a/packages/designer/src/builtin-simulator/utils/parse-metadata.ts +++ b/packages/designer/src/builtin-simulator/utils/parse-metadata.ts @@ -1,7 +1,7 @@ import PropTypes from 'prop-types'; import { isValidElement } from 'react'; -import { isElement } from '@alilc/lowcode-utils'; -import { IPublicTypePropConfig } from '@alilc/lowcode-types'; +import { isElement } from '@felce/lowcode-utils'; +import { IPublicTypePropConfig } from '@felce/lowcode-types'; export const primitiveTypes = [ 'string', @@ -42,7 +42,10 @@ function makeRequired(propType: any, lowcodeType: string | object): LowcodeCheck } // eslint-disable-next-line @typescript-eslint/ban-types -function define(propType: any = PropTypes.any, lowcodeType: string | object = {}): LowcodeCheckType { +function define( + propType: any = PropTypes.any, + lowcodeType: string | object = {}, +): LowcodeCheckType { if (!propType._inner && propType.name !== 'lowcodeCheckType') { propType.lowcodeType = lowcodeType; } diff --git a/packages/designer/src/builtin-simulator/viewport.ts b/packages/designer/src/builtin-simulator/viewport.ts index b37cad7eec..7ecb84fc17 100644 --- a/packages/designer/src/builtin-simulator/viewport.ts +++ b/packages/designer/src/builtin-simulator/viewport.ts @@ -1,4 +1,4 @@ -import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core'; +import { obx, computed, makeObservable } from '@felce/lowcode-editor-core'; import { Point, ScrollTarget } from '../designer'; import { AutoFit, IViewport } from '../simulator'; diff --git a/packages/designer/src/component-actions.ts b/packages/designer/src/component-actions.ts index 57ad30bf25..733f8a0ec8 100644 --- a/packages/designer/src/component-actions.ts +++ b/packages/designer/src/component-actions.ts @@ -1,19 +1,20 @@ -import { IPublicModelNode, IPublicTypeComponentAction, IPublicTypeMetadataTransducer } from '@alilc/lowcode-types'; -import { engineConfig } from '@alilc/lowcode-editor-core'; -import { intlNode } from './locale'; import { - IconLock, - IconUnlock, - IconRemove, - IconClone, - IconHidden, -} from './icons'; + IPublicModelNode, + IPublicTypeComponentAction, + IPublicTypeMetadataTransducer, +} from '@felce/lowcode-types'; +import { engineConfig } from '@felce/lowcode-editor-core'; +import { intlNode } from './locale'; +import { IconLock, IconUnlock, IconRemove, IconClone, IconHidden } from './icons'; import { componentDefaults, legacyIssues } from './transducers'; function deduplicateRef(node: IPublicModelNode | null | undefined) { const currentRef = node?.getPropValue('ref'); if (currentRef) { - node?.setPropValue('ref', `${node.componentName.toLowerCase()}-${Math.random().toString(36).slice(2, 9)}`); + node?.setPropValue( + 'ref', + `${node.componentName.toLowerCase()}-${Math.random().toString(36).slice(2, 9)}`, + ); } node?.children?.forEach(deduplicateRef); } @@ -67,7 +68,9 @@ export class ComponentActions { if (isRGL) { // 复制 layout 信息 const layout: any = rglNode?.getPropValue('layout') || []; - const curLayout = layout.filter((item: any) => item.i === node.getPropValue('fieldId')); + const curLayout = layout.filter( + (item: any) => item.i === node.getPropValue('fieldId'), + ); if (curLayout && curLayout[0]) { layout.push({ ...curLayout[0], @@ -75,7 +78,10 @@ export class ComponentActions { }); rglNode?.setPropValue('layout', layout); // 如果是磁贴块复制,则需要滚动到影响位置 - setTimeout(() => newNode?.document?.project?.simulatorHost?.scrollToNode(newNode), 10); + setTimeout( + () => newNode?.document?.project?.simulatorHost?.scrollToNode(newNode), + 10, + ); } } } @@ -95,7 +101,9 @@ export class ComponentActions { }, /* istanbul ignore next */ condition: (node: IPublicModelNode) => { - return engineConfig.get('enableCanvasLock', false) && node.isContainerNode && !node.isLocked; + return ( + engineConfig.get('enableCanvasLock', false) && node.isContainerNode && !node.isLocked + ); }, important: true, }, @@ -142,14 +150,12 @@ export class ComponentActions { } } - registerMetadataTransducer( - transducer: IPublicTypeMetadataTransducer, - level = 100, - id?: string, - ) { + registerMetadataTransducer(transducer: IPublicTypeMetadataTransducer, level = 100, id?: string) { transducer.level = level; transducer.id = id; - const i = this.metadataTransducers.findIndex((item) => item.level != null && item.level > level); + const i = this.metadataTransducers.findIndex( + (item) => item.level != null && item.level > level, + ); if (i < 0) { this.metadataTransducers.push(transducer); } else { @@ -160,4 +166,4 @@ export class ComponentActions { getRegisteredMetadataTransducers(): IPublicTypeMetadataTransducer[] { return this.metadataTransducers; } -} \ No newline at end of file +} diff --git a/packages/designer/src/component-meta.ts b/packages/designer/src/component-meta.ts index 1ee1154f18..261ab4dd17 100644 --- a/packages/designer/src/component-meta.ts +++ b/packages/designer/src/component-meta.ts @@ -13,16 +13,12 @@ import { IPublicTypeAdvanced, IPublicTypeDisposable, IPublicTypeLiveTextEditingConfig, -} from '@alilc/lowcode-types'; -import { deprecate, isRegExp, isTitleConfig, isNode } from '@alilc/lowcode-utils'; -import { computed, createModuleEventBus, IEventBus } from '@alilc/lowcode-editor-core'; +} from '@felce/lowcode-types'; +import { deprecate, isRegExp, isTitleConfig, isNode } from '@felce/lowcode-utils'; +import { computed, createModuleEventBus, IEventBus } from '@felce/lowcode-editor-core'; import { Node, INode } from './document'; import { Designer } from './designer'; -import { - IconContainer, - IconPage, - IconComponent, -} from './icons'; +import { IconContainer, IconPage, IconComponent } from './icons'; export function ensureAList(list?: string | string[]): string[] | null { if (!list) { @@ -138,7 +134,7 @@ export class ComponentMeta implements IComponentMeta { private _isTopFixed?: boolean; get isTopFixed(): boolean { - return !!(this._isTopFixed); + return !!this._isTopFixed; } private parentWhitelist?: IPublicTypeNestingFilter | null; @@ -184,7 +180,10 @@ export class ComponentMeta implements IComponentMeta { */ prototype?: any; - constructor(readonly designer: Designer, metadata: IPublicTypeComponentMetadata) { + constructor( + readonly designer: Designer, + metadata: IPublicTypeComponentMetadata, + ) { this.parseMetadata(metadata); } @@ -287,8 +286,8 @@ export class ComponentMeta implements IComponentMeta { } private transformMetadata( - metadta: IPublicTypeComponentMetadata, - ): IPublicTypeTransformedComponentMetadata { + metadta: IPublicTypeComponentMetadata, + ): IPublicTypeTransformedComponentMetadata { const registeredTransducers = this.designer.componentActions.getRegisteredMetadataTransducers(); const result = registeredTransducers.reduce((prevMetadata, current) => { return current(prevMetadata); @@ -351,7 +350,10 @@ export class ComponentMeta implements IComponentMeta { return true; } - checkNestingDown(my: INode, target: INode | IPublicTypeNodeSchema | IPublicTypeNodeSchema[]): boolean { + checkNestingDown( + my: INode, + target: INode | IPublicTypeNodeSchema | IPublicTypeNodeSchema[], + ): boolean { // 检查父子关系,直接约束型,在画布中拖拽直接掠过目标容器 if (this.childWhitelist) { const _target: any = !Array.isArray(target) ? [target] : target; @@ -372,14 +374,15 @@ export class ComponentMeta implements IComponentMeta { this.emitter.removeListener('metadata_change', fn); }; } - } export function isComponentMeta(obj: any): obj is ComponentMeta { return obj && obj.isComponentMeta; } -function preprocessMetadata(metadata: IPublicTypeComponentMetadata): IPublicTypeTransformedComponentMetadata { +function preprocessMetadata( + metadata: IPublicTypeComponentMetadata, +): IPublicTypeTransformedComponentMetadata { if (metadata.configure) { if (Array.isArray(metadata.configure)) { return { diff --git a/packages/designer/src/context-menu-actions.ts b/packages/designer/src/context-menu-actions.ts index c88e03ac65..4bb052aa3a 100644 --- a/packages/designer/src/context-menu-actions.ts +++ b/packages/designer/src/context-menu-actions.ts @@ -1,8 +1,19 @@ -import { IPublicTypeContextMenuAction, IPublicEnumContextMenuType, IPublicTypeContextMenuItem, IPublicApiMaterial, IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { + IPublicTypeContextMenuAction, + IPublicEnumContextMenuType, + IPublicTypeContextMenuItem, + IPublicApiMaterial, + IPublicModelPluginContext, +} from '@felce/lowcode-types'; import { IDesigner, INode } from './designer'; -import { createContextMenu, parseContextMenuAsReactNode, parseContextMenuProperties, uniqueId } from '@alilc/lowcode-utils'; +import { + createContextMenu, + parseContextMenuAsReactNode, + parseContextMenuProperties, + uniqueId, +} from '@felce/lowcode-utils'; import { Menu } from '@alifd/next'; -import { engineConfig } from '@alilc/lowcode-editor-core'; +import { engineConfig } from '@felce/lowcode-editor-core'; import './context-menu-actions.scss'; export interface IContextMenuActions { @@ -34,16 +45,14 @@ export class GlobalContextMenuActions { return; } this.enableContextMenu = enable; - this.dispose.forEach(d => d()); + this.dispose.forEach((d) => d()); if (enable) { this.initEvent(); } }); } - handleContextMenu = ( - event: MouseEvent, - ) => { + handleContextMenu = (event: MouseEvent) => { event.stopPropagation(); event.preventDefault(); @@ -58,7 +67,9 @@ export class GlobalContextMenuActions { const destroy = () => { destroyFn?.(); }; - const pluginContext: IPublicModelPluginContext = contextMenu.designer.editor.get('pluginContext') as IPublicModelPluginContext; + const pluginContext: IPublicModelPluginContext = contextMenu.designer.editor.get( + 'pluginContext', + ) as IPublicModelPluginContext; const menus: IPublicTypeContextMenuItem[] = parseContextMenuProperties(actions, { nodes: [], @@ -125,7 +136,7 @@ export class ContextMenuActions implements IContextMenuActions { enableContextMenu: boolean; - id: string = uniqueId('contextMenu');; + id: string = uniqueId('contextMenu'); constructor(designer: IDesigner) { this.designer = designer; @@ -136,7 +147,7 @@ export class ContextMenuActions implements IContextMenuActions { return; } this.enableContextMenu = enable; - this.dispose.forEach(d => d()); + this.dispose.forEach((d) => d()); if (enable) { this.initEvent(); } @@ -145,10 +156,7 @@ export class ContextMenuActions implements IContextMenuActions { globalContextMenuActions.registerContextMenuActions(this); } - handleContextMenu = ( - nodes: INode[], - event: MouseEvent, - ) => { + handleContextMenu = (nodes: INode[], event: MouseEvent) => { const designer = this.designer; event.stopPropagation(); event.preventDefault(); @@ -164,10 +172,12 @@ export class ContextMenuActions implements IContextMenuActions { destroyFn?.(); }; - const pluginContext: IPublicModelPluginContext = this.designer.editor.get('pluginContext') as IPublicModelPluginContext; + const pluginContext: IPublicModelPluginContext = this.designer.editor.get( + 'pluginContext', + ) as IPublicModelPluginContext; const menus: IPublicTypeContextMenuItem[] = parseContextMenuProperties(actions, { - nodes: nodes.map(d => designer.shellModelFactory.createNode(d)!), + nodes: nodes.map((d) => designer.shellModelFactory.createNode(d)!), destroy, event, pluginContext, @@ -181,7 +191,7 @@ export class ContextMenuActions implements IContextMenuActions { const menuNode = parseContextMenuAsReactNode(layoutMenu, { destroy, - nodes: nodes.map(d => designer.shellModelFactory.createNode(d)!), + nodes: nodes.map((d) => designer.shellModelFactory.createNode(d)!), pluginContext, }); @@ -194,22 +204,19 @@ export class ContextMenuActions implements IContextMenuActions { initEvent() { const designer = this.designer; this.dispose.push( - designer.editor.eventBus.on('designer.builtinSimulator.contextmenu', ({ - node, - originalEvent, - }: { - node: INode; - originalEvent: MouseEvent; - }) => { - originalEvent.stopPropagation(); - originalEvent.preventDefault(); - // 如果右键的节点不在 当前选中的节点中,选中该节点 - if (!designer.currentSelection.has(node.id)) { - designer.currentSelection.select(node.id); - } - const nodes = designer.currentSelection.getNodes(); - this.handleContextMenu(nodes, originalEvent); - }), + designer.editor.eventBus.on( + 'designer.builtinSimulator.contextmenu', + ({ node, originalEvent }: { node: INode; originalEvent: MouseEvent }) => { + originalEvent.stopPropagation(); + originalEvent.preventDefault(); + // 如果右键的节点不在 当前选中的节点中,选中该节点 + if (!designer.currentSelection.has(node.id)) { + designer.currentSelection.select(node.id); + } + const nodes = designer.currentSelection.getNodes(); + this.handleContextMenu(nodes, originalEvent); + }, + ), ); } @@ -230,4 +237,4 @@ export class ContextMenuActions implements IContextMenuActions { adjustMenuLayout(fn: (actions: IPublicTypeContextMenuItem[]) => IPublicTypeContextMenuItem[]) { adjustMenuLayoutFn = fn; } -} \ No newline at end of file +} diff --git a/packages/designer/src/designer/active-tracker.ts b/packages/designer/src/designer/active-tracker.ts index 74d865673f..69ce1122b9 100644 --- a/packages/designer/src/designer/active-tracker.ts +++ b/packages/designer/src/designer/active-tracker.ts @@ -1,12 +1,9 @@ import { INode } from '../document/node/node'; -import { obx, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core'; -import { - IPublicTypeActiveTarget, - IPublicModelActiveTracker, -} from '@alilc/lowcode-types'; -import { isNode } from '@alilc/lowcode-utils'; - -export interface IActiveTracker extends Omit< IPublicModelActiveTracker, 'track' | 'onChange' > { +import { obx, IEventBus, createModuleEventBus } from '@felce/lowcode-editor-core'; +import { IPublicTypeActiveTarget, IPublicModelActiveTracker } from '@felce/lowcode-types'; +import { isNode } from '@felce/lowcode-utils'; + +export interface IActiveTracker extends Omit<IPublicModelActiveTracker, 'track' | 'onChange'> { _target: ActiveTarget | INode; track(originalTarget: ActiveTarget | INode): void; @@ -14,7 +11,7 @@ export interface IActiveTracker extends Omit< IPublicModelActiveTracker, 'track' onChange(fn: (target: ActiveTarget) => void): () => void; } -export interface ActiveTarget extends Omit< IPublicTypeActiveTarget, 'node' > { +export interface ActiveTarget extends Omit<IPublicTypeActiveTarget, 'node'> { node: INode; } diff --git a/packages/designer/src/designer/clipboard.ts b/packages/designer/src/designer/clipboard.ts index 34ce2b5b53..675fffd00d 100644 --- a/packages/designer/src/designer/clipboard.ts +++ b/packages/designer/src/designer/clipboard.ts @@ -1,4 +1,4 @@ -import { IPublicModelClipboard } from '@alilc/lowcode-types'; +import { IPublicModelClipboard } from '@felce/lowcode-types'; function getDataFromPasteEvent(event: ClipboardEvent) { const { clipboardData } = event; @@ -21,12 +21,11 @@ function getDataFromPasteEvent(event: ClipboardEvent) { } } catch (error) { // TODO: open the parser implement - return { }; + return {}; } } export interface IClipboard extends IPublicModelClipboard { - initCopyPaster(el: HTMLTextAreaElement): void; injectCopyPaster(document: Document): void; diff --git a/packages/designer/src/designer/designer.ts b/packages/designer/src/designer/designer.ts index 1dd4bc04e6..70ceaa4442 100644 --- a/packages/designer/src/designer/designer.ts +++ b/packages/designer/src/designer/designer.ts @@ -1,5 +1,13 @@ import { ComponentType } from 'react'; -import { obx, computed, autorun, makeObservable, IReactionPublic, IReactionOptions, IReactionDisposer } from '@alilc/lowcode-editor-core'; +import { + obx, + computed, + autorun, + makeObservable, + IReactionPublic, + IReactionOptions, + IReactionDisposer, +} from '@felce/lowcode-editor-core'; import { IPublicTypeProjectSchema, IPublicTypeComponentMetadata, @@ -17,8 +25,16 @@ import { IPublicTypeLocationData, IPublicEnumTransformStage, IPublicModelLocateEvent, -} from '@alilc/lowcode-types'; -import { mergeAssets, IPublicTypeAssetsJson, isNodeSchema, isDragNodeObject, isDragNodeDataObject, isLocationChildrenDetail, Logger } from '@alilc/lowcode-utils'; +} from '@felce/lowcode-types'; +import { + mergeAssets, + IPublicTypeAssetsJson, + isNodeSchema, + isDragNodeObject, + isDragNodeDataObject, + isLocationChildrenDetail, + Logger, +} from '@felce/lowcode-utils'; import { IProject, Project } from '../project'; import { Node, DocumentModel, insertChildren, INode, ISelection } from '../document'; import { ComponentMeta, IComponentMeta } from '../component-meta'; @@ -55,9 +71,9 @@ export interface DesignerProps { onDragstart?: (e: IPublicModelLocateEvent) => void; onDrag?: (e: IPublicModelLocateEvent) => void; onDragend?: ( - e: { dragObject: IPublicModelDragObject; copy: boolean }, - loc?: DropLocation, - ) => void; + e: { dragObject: IPublicModelDragObject; copy: boolean }, + loc?: DropLocation, + ) => void; } export interface IDesigner { @@ -113,11 +129,18 @@ export interface IDesigner { postEvent(event: string, ...args: any[]): void; - transformProps(props: IPublicTypeCompositeObject | IPublicTypePropsList, node: Node, stage: IPublicEnumTransformStage): IPublicTypeCompositeObject | IPublicTypePropsList; + transformProps( + props: IPublicTypeCompositeObject | IPublicTypePropsList, + node: Node, + stage: IPublicEnumTransformStage, + ): IPublicTypeCompositeObject | IPublicTypePropsList; createSettingEntry(nodes: INode[]): ISettingTopEntry; - autorun(effect: (reaction: IReactionPublic) => void, options?: IReactionOptions<any, any>): IReactionDisposer; + autorun( + effect: (reaction: IReactionPublic) => void, + options?: IReactionOptions<any, any>, + ): IReactionDisposer; } export class Designer implements IDesigner { @@ -313,7 +336,11 @@ export class Designer implements IDesigner { */ createLocation(locationData: IPublicTypeLocationData<INode>): DropLocation { const loc = new DropLocation(locationData); - if (this._dropLocation && this._dropLocation.document && this._dropLocation.document !== loc.document) { + if ( + this._dropLocation && + this._dropLocation.document && + this._dropLocation.document !== loc.document + ) { this._dropLocation.document.dropLocation = null; } this._dropLocation = loc; @@ -612,7 +639,11 @@ export class Designer implements IDesigner { return maps; } - transformProps(props: IPublicTypeCompositeObject | IPublicTypePropsList, node: Node, stage: IPublicEnumTransformStage) { + transformProps( + props: IPublicTypeCompositeObject | IPublicTypePropsList, + node: Node, + stage: IPublicEnumTransformStage, + ) { if (Array.isArray(props)) { // current not support, make this future return props; @@ -647,7 +678,10 @@ export class Designer implements IDesigner { } } - autorun(effect: (reaction: IReactionPublic) => void, options?: IReactionOptions<any, any>): IReactionDisposer { + autorun( + effect: (reaction: IReactionPublic) => void, + options?: IReactionOptions<any, any>, + ): IReactionDisposer { return autorun(effect, options); } diff --git a/packages/designer/src/designer/detecting.ts b/packages/designer/src/designer/detecting.ts index a5d898d6e0..61ab306935 100644 --- a/packages/designer/src/designer/detecting.ts +++ b/packages/designer/src/designer/detecting.ts @@ -1,14 +1,11 @@ -import { makeObservable, obx, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core'; -import { IPublicModelDetecting } from '@alilc/lowcode-types'; +import { makeObservable, obx, IEventBus, createModuleEventBus } from '@felce/lowcode-editor-core'; +import { IPublicModelDetecting } from '@felce/lowcode-types'; import type { IDocumentModel } from '../document/document-model'; import type { INode } from '../document/node/node'; const DETECTING_CHANGE_EVENT = 'detectingChange'; -export interface IDetecting extends Omit<IPublicModelDetecting<INode>, - 'capture' | - 'release' | - 'leave' -> { +export interface IDetecting + extends Omit<IPublicModelDetecting<INode>, 'capture' | 'release' | 'leave'> { capture(node: INode | null): void; release(node: INode | null): void; diff --git a/packages/designer/src/designer/drag-ghost/index.tsx b/packages/designer/src/designer/drag-ghost/index.tsx index 50fca2f28e..8fd4d6e9fe 100644 --- a/packages/designer/src/designer/drag-ghost/index.tsx +++ b/packages/designer/src/designer/drag-ghost/index.tsx @@ -1,10 +1,14 @@ import { Component, ReactElement } from 'react'; -import { observer, obx, Title, makeObservable } from '@alilc/lowcode-editor-core'; +import { observer, obx, Title, makeObservable } from '@felce/lowcode-editor-core'; import { Designer } from '../designer'; import { isDragNodeObject } from '../dragon'; import { isSimulatorHost } from '../../simulator'; import './ghost.less'; -import { IPublicTypeI18nData, IPublicTypeNodeSchema, IPublicModelDragObject } from '@alilc/lowcode-types'; +import { + IPublicTypeI18nData, + IPublicTypeNodeSchema, + IPublicModelDragObject, +} from '@felce/lowcode-types'; type offBinding = () => any; @@ -26,7 +30,7 @@ export default class DragGhost extends Component<{ designer: Designer }> { super(props); makeObservable(this); this.dispose = [ - this.dragon.onDragstart(e => { + this.dragon.onDragstart((e) => { if (e.originalEvent.type.slice(0, 4) === 'drag') { return; } @@ -34,7 +38,7 @@ export default class DragGhost extends Component<{ designer: Designer }> { this.x = e.globalX; this.y = e.globalY; }), - this.dragon.onDrag(e => { + this.dragon.onDrag((e) => { this.x = e.globalX; this.y = e.globalY; if (isSimulatorHost(e.sensor)) { @@ -61,12 +65,15 @@ export default class DragGhost extends Component<{ designer: Designer }> { const dataList = Array.isArray(dragObject.data) ? dragObject.data : [dragObject.data]; - return dataList.map((item: IPublicTypeNodeSchema, i) => (this.props.designer.getComponentMeta(item.componentName).title)); + return dataList.map( + (item: IPublicTypeNodeSchema, i) => + this.props.designer.getComponentMeta(item.componentName).title, + ); } componentWillUnmount() { if (this.dispose) { - this.dispose.forEach(off => off()); + this.dispose.forEach((off) => off()); } } diff --git a/packages/designer/src/designer/dragon.ts b/packages/designer/src/designer/dragon.ts index 8dcce2b4a2..a34273a904 100644 --- a/packages/designer/src/designer/dragon.ts +++ b/packages/designer/src/designer/dragon.ts @@ -1,4 +1,4 @@ -import { obx, makeObservable, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core'; +import { obx, makeObservable, IEventBus, createModuleEventBus } from '@felce/lowcode-editor-core'; import { IPublicTypeDragNodeObject, IPublicTypeDragAnyObject, @@ -9,8 +9,8 @@ import { IPublicModelDragon, IPublicModelLocateEvent, IPublicModelSensor, -} from '@alilc/lowcode-types'; -import { setNativeSelection, cursor } from '@alilc/lowcode-utils'; +} from '@felce/lowcode-types'; +import { setNativeSelection, cursor } from '@felce/lowcode-utils'; import { INode, Node } from '../document'; import { ISimulatorHost, isSimulatorHost } from '../simulator'; import { IDesigner } from './designer'; @@ -26,24 +26,28 @@ export interface ILocateEvent extends IPublicModelLocateEvent { } /** - * @deprecated use same function in @alilc/lowcode-utils + * @deprecated use same function in @felce/lowcode-utils */ export function isDragNodeObject(obj: any): obj is IPublicTypeDragNodeObject { return obj && obj.type === IPublicEnumDragObjectType.Node; } /** - * @deprecated use same function in @alilc/lowcode-utils + * @deprecated use same function in @felce/lowcode-utils */ export function isDragNodeDataObject(obj: any): obj is IPublicTypeDragNodeDataObject { return obj && obj.type === IPublicEnumDragObjectType.NodeData; } /** - * @deprecated use same function in @alilc/lowcode-utils + * @deprecated use same function in @felce/lowcode-utils */ export function isDragAnyObject(obj: any): obj is IPublicTypeDragAnyObject { - return obj && obj.type !== IPublicEnumDragObjectType.NodeData && obj.type !== IPublicEnumDragObjectType.Node; + return ( + obj && + obj.type !== IPublicEnumDragObjectType.NodeData && + obj.type !== IPublicEnumDragObjectType.Node + ); } export function isLocateEvent(e: any): e is ILocateEvent { @@ -95,10 +99,7 @@ function isDragEvent(e: any): e is DragEvent { return e?.type?.startsWith('drag'); } -export interface IDragon extends IPublicModelDragon< - INode, - ILocateEvent -> { +export interface IDragon extends IPublicModelDragon<INode, ILocateEvent> { emitter: IEventBus; } @@ -170,13 +171,20 @@ export class Dragon implements IDragon { * @param dragObject 拖拽对象 * @param boostEvent 拖拽初始时事件 */ - boost(dragObject: IPublicModelDragObject, boostEvent: MouseEvent | DragEvent, fromRglNode?: INode | IPublicModelNode) { + boost( + dragObject: IPublicModelDragObject, + boostEvent: MouseEvent | DragEvent, + fromRglNode?: INode | IPublicModelNode, + ) { const { designer } = this; const masterSensors = this.getMasterSensors(); const handleEvents = makeEventsHandler(boostEvent, masterSensors); const newBie = !isDragNodeObject(dragObject); const forceCopyState = - isDragNodeObject(dragObject) && dragObject.nodes.some((node: Node | IPublicModelNode) => (typeof node.isSlot === 'function' ? node.isSlot() : node.isSlot)); + isDragNodeObject(dragObject) && + dragObject.nodes.some((node: Node | IPublicModelNode) => + typeof node.isSlot === 'function' ? node.isSlot() : node.isSlot, + ); const isBoostFromDragAPI = isDragEvent(boostEvent); let lastSensor: IPublicModelSensor | undefined; @@ -433,7 +441,7 @@ export class Dragon implements IDragon { if (!sourceDocument || sourceDocument === document) { evt.globalX = e.clientX; evt.globalY = e.clientY; - } else /* istanbul ignore next */ { + } /* istanbul ignore next */ else { // event from simulator sandbox let srcSim: ISimulatorHost | undefined; const lastSim = lastSensor && isSimulatorHost(lastSensor) ? lastSensor : null; @@ -467,7 +475,9 @@ export class Dragon implements IDragon { /* istanbul ignore next */ const chooseSensor = (e: ILocateEvent) => { // this.sensors will change on dragstart - const sensors: IPublicModelSensor[] = this.sensors.concat(masterSensors as IPublicModelSensor[]); + const sensors: IPublicModelSensor[] = this.sensors.concat( + masterSensors as IPublicModelSensor[], + ); let sensor = e.sensor && e.sensor.isEnter(e) ? e.sensor diff --git a/packages/designer/src/designer/location.ts b/packages/designer/src/designer/location.ts index 3b9b080cd6..9f37afed7d 100644 --- a/packages/designer/src/designer/location.ts +++ b/packages/designer/src/designer/location.ts @@ -7,7 +7,7 @@ import { IPublicTypeLocationDetail, IPublicTypeLocationData, IPublicModelLocateEvent, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; export interface Point { clientX: number; @@ -24,14 +24,14 @@ export type Rects = DOMRect[] & { }; /** - * @deprecated use same function in @alilc/lowcode-utils + * @deprecated use same function in @felce/lowcode-utils */ export function isLocationData(obj: any): boolean { return obj && obj.target && obj.detail; } /** - * @deprecated use same function in @alilc/lowcode-utils + * @deprecated use same function in @felce/lowcode-utils */ export function isLocationChildrenDetail(obj: any): boolean { return obj && obj.type === IPublicTypeLocationDetailType.Children; @@ -60,7 +60,10 @@ export function isChildInline(child: Element | Text, win?: Window) { return true; } const style = (win || getWindow(child)).getComputedStyle(child); - return /^inline/.test(style.getPropertyValue('display')) || /^(left|right)$/.test(style.getPropertyValue('float')); + return ( + /^inline/.test(style.getPropertyValue('display')) || + /^(left|right)$/.test(style.getPropertyValue('float')) + ); } export function getRectTarget(rect: IPublicTypeRect | null) { @@ -99,7 +102,6 @@ export function getWindow(elem: Element | Document): Window { return (isDocument(elem) ? elem : elem.ownerDocument!).defaultView!; } export interface IDropLocation extends Omit<IPublicModelDropLocation, 'target' | 'clone'> { - readonly source: string; get target(): INode; diff --git a/packages/designer/src/designer/offset-observer.ts b/packages/designer/src/designer/offset-observer.ts index 2cf5bfee26..0bf4735e43 100644 --- a/packages/designer/src/designer/offset-observer.ts +++ b/packages/designer/src/designer/offset-observer.ts @@ -1,6 +1,6 @@ import requestIdleCallback, { cancelIdleCallback } from 'ric-shim'; -import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core'; -import { uniqueId } from '@alilc/lowcode-utils'; +import { obx, computed, makeObservable } from '@felce/lowcode-editor-core'; +import { uniqueId } from '@felce/lowcode-utils'; import { INodeSelector, IViewport } from '../simulator'; import { INode } from '../document'; diff --git a/packages/designer/src/designer/scroller.ts b/packages/designer/src/designer/scroller.ts index 7391c39fab..3e26613af3 100644 --- a/packages/designer/src/designer/scroller.ts +++ b/packages/designer/src/designer/scroller.ts @@ -1,8 +1,11 @@ -import { isElement } from '@alilc/lowcode-utils'; -import { IPublicModelScrollTarget, IPublicTypeScrollable, IPublicModelScroller } from '@alilc/lowcode-types'; +import { isElement } from '@felce/lowcode-utils'; +import { + IPublicModelScrollTarget, + IPublicTypeScrollable, + IPublicModelScroller, +} from '@felce/lowcode-types'; -export interface IScrollTarget extends IPublicModelScrollTarget { -} +export interface IScrollTarget extends IPublicModelScrollTarget {} export class ScrollTarget implements IScrollTarget { get left() { @@ -48,9 +51,7 @@ function easing(n: number) { const SCROLL_ACCURACY = 30; -export interface IScroller extends IPublicModelScroller { - -} +export interface IScroller extends IPublicModelScroller {} export class Scroller implements IScroller { private pid: number | undefined; scrollable: IPublicTypeScrollable; diff --git a/packages/designer/src/designer/setting/setting-entry-type.ts b/packages/designer/src/designer/setting/setting-entry-type.ts index 1aee9016e5..cdd1e0cfe2 100644 --- a/packages/designer/src/designer/setting/setting-entry-type.ts +++ b/packages/designer/src/designer/setting/setting-entry-type.ts @@ -1,4 +1,4 @@ -import { IPublicApiSetters, IPublicModelEditor } from '@alilc/lowcode-types'; +import { IPublicApiSetters, IPublicModelEditor } from '@felce/lowcode-types'; import { IDesigner } from '../designer'; import { INode } from '../../document'; import { ISettingField } from './setting-field'; diff --git a/packages/designer/src/designer/setting/setting-field.ts b/packages/designer/src/designer/setting/setting-field.ts index 1a63fb7a40..6c733aa38e 100644 --- a/packages/designer/src/designer/setting/setting-field.ts +++ b/packages/designer/src/designer/setting/setting-field.ts @@ -9,18 +9,19 @@ import { IPublicTypeDisposable, IPublicModelSettingField, IBaseModelSettingField, -} from '@alilc/lowcode-types'; -import type { - IPublicTypeSetValueOptions, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; +import type { IPublicTypeSetValueOptions } from '@felce/lowcode-types'; import { Transducer } from './utils'; import { ISettingPropEntry, SettingPropEntry } from './setting-prop-entry'; -import { computed, obx, makeObservable, action, untracked, intl } from '@alilc/lowcode-editor-core'; -import { cloneDeep, isCustomView, isDynamicSetter, isJSExpression } from '@alilc/lowcode-utils'; +import { computed, obx, makeObservable, action, untracked, intl } from '@felce/lowcode-editor-core'; +import { cloneDeep, isCustomView, isDynamicSetter, isJSExpression } from '@felce/lowcode-utils'; import { ISettingTopEntry } from './setting-top-entry'; -import { IComponentMeta, INode } from '@alilc/lowcode-designer'; +import { IComponentMeta, INode } from '@felce/lowcode-designer'; -function getSettingFieldCollectorKey(parent: ISettingTopEntry | ISettingField, config: IPublicTypeFieldConfig) { +function getSettingFieldCollectorKey( + parent: ISettingTopEntry | ISettingField, + config: IPublicTypeFieldConfig, +) { let cur = parent; const path = [config.name]; while (cur !== parent.top) { @@ -32,12 +33,12 @@ function getSettingFieldCollectorKey(parent: ISettingTopEntry | ISettingField, c return path.join('.'); } -export interface ISettingField extends ISettingPropEntry, Omit<IBaseModelSettingField< - ISettingTopEntry, - ISettingField, - IComponentMeta, - INode ->, 'setValue' | 'key' | 'node'> { +export interface ISettingField + extends ISettingPropEntry, + Omit< + IBaseModelSettingField<ISettingTopEntry, ISettingField, IComponentMeta, INode>, + 'setValue' | 'key' | 'node' + > { readonly isSettingField: true; readonly isRequired: boolean; @@ -316,7 +317,7 @@ export class SettingField extends SettingPropEntry implements ISettingField { } /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utilsinstead */ export function isSettingField(obj: any): obj is ISettingField { return obj && obj.isSettingField; diff --git a/packages/designer/src/designer/setting/setting-prop-entry.ts b/packages/designer/src/designer/setting/setting-prop-entry.ts index d6904f0c82..994201a17c 100644 --- a/packages/designer/src/designer/setting/setting-prop-entry.ts +++ b/packages/designer/src/designer/setting/setting-prop-entry.ts @@ -1,6 +1,20 @@ -import { obx, computed, makeObservable, runInAction, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core'; -import { GlobalEvent, IPublicApiSetters, IPublicModelEditor, IPublicModelSettingField, IPublicTypeFieldExtraProps, IPublicTypeSetValueOptions } from '@alilc/lowcode-types'; -import { uniqueId, isJSExpression } from '@alilc/lowcode-utils'; +import { + obx, + computed, + makeObservable, + runInAction, + IEventBus, + createModuleEventBus, +} from '@felce/lowcode-editor-core'; +import { + GlobalEvent, + IPublicApiSetters, + IPublicModelEditor, + IPublicModelSettingField, + IPublicTypeFieldExtraProps, + IPublicTypeSetValueOptions, +} from '@felce/lowcode-types'; +import { uniqueId, isJSExpression } from '@felce/lowcode-utils'; import { ISettingEntry } from './setting-entry-type'; import { INode } from '../../document'; import type { IComponentMeta } from '../../component-meta'; @@ -33,7 +47,12 @@ export interface ISettingPropEntry extends ISettingEntry { remove(): void; - setValue(val: any, isHotValue?: boolean, force?: boolean, extraOptions?: IPublicTypeSetValueOptions): void; + setValue( + val: any, + isHotValue?: boolean, + force?: boolean, + extraOptions?: IPublicTypeSetValueOptions, + ): void; internalToShellField(): IPublicModelSettingField; } @@ -83,7 +102,11 @@ export class SettingPropEntry implements ISettingPropEntry { extraProps: IPublicTypeFieldExtraProps = {}; - constructor(readonly parent: ISettingTopEntry | ISettingField, name: string | number | undefined, type?: 'field' | 'group') { + constructor( + readonly parent: ISettingTopEntry | ISettingField, + name: string | number | undefined, + type?: 'field' | 'group', + ) { makeObservable(this); if (type == null) { const c = typeof name === 'string' ? name.slice(0, 1) : ''; @@ -206,7 +229,12 @@ export class SettingPropEntry implements ISettingPropEntry { /** * 设置当前属性值 */ - setValue(val: any, isHotValue?: boolean, force?: boolean, extraOptions?: IPublicTypeSetValueOptions) { + setValue( + val: any, + isHotValue?: boolean, + force?: boolean, + extraOptions?: IPublicTypeSetValueOptions, + ) { const oldValue = this.getValue(); if (this.type === 'field') { this.name?.toString() && this.parent.setPropValue(this.name, val); diff --git a/packages/designer/src/designer/setting/setting-top-entry.ts b/packages/designer/src/designer/setting/setting-top-entry.ts index 85be74b7f6..ddd5124113 100644 --- a/packages/designer/src/designer/setting/setting-top-entry.ts +++ b/packages/designer/src/designer/setting/setting-top-entry.ts @@ -1,6 +1,11 @@ -import { IPublicTypeCustomView, IPublicModelEditor, IPublicModelSettingTopEntry, IPublicApiSetters } from '@alilc/lowcode-types'; -import { isCustomView } from '@alilc/lowcode-utils'; -import { computed, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core'; +import { + IPublicTypeCustomView, + IPublicModelEditor, + IPublicModelSettingTopEntry, + IPublicApiSetters, +} from '@felce/lowcode-types'; +import { isCustomView } from '@felce/lowcode-utils'; +import { computed, IEventBus, createModuleEventBus } from '@felce/lowcode-editor-core'; import { ISettingEntry } from './setting-entry-type'; import { ISettingField, SettingField } from './setting-field'; import { INode } from '../../document'; @@ -14,10 +19,9 @@ function generateSessionId(nodes: INode[]) { .join(','); } -export interface ISettingTopEntry extends ISettingEntry, IPublicModelSettingTopEntry< - INode, - ISettingField -> { +export interface ISettingTopEntry + extends ISettingEntry, + IPublicModelSettingTopEntry<INode, ISettingField> { readonly top: ISettingTopEntry; readonly parent: ISettingTopEntry; @@ -95,7 +99,10 @@ export class SettingTopEntry implements ISettingTopEntry { disposeFunctions: any[] = []; - constructor(readonly editor: IPublicModelEditor, readonly nodes: INode[]) { + constructor( + readonly editor: IPublicModelEditor, + readonly nodes: INode[], + ) { if (!Array.isArray(nodes) || nodes.length < 1) { throw new ReferenceError('nodes should not be empty'); } @@ -177,7 +184,7 @@ export class SettingTopEntry implements ISettingTopEntry { */ get(propName: string | number): ISettingField | null { if (!propName) return null; - return this._settingFieldMap[propName] || (new SettingField(this, { name: propName })); + return this._settingFieldMap[propName] || new SettingField(this, { name: propName }); } /** @@ -244,7 +251,7 @@ export class SettingTopEntry implements ISettingTopEntry { this.disposeItems(); this._settingFieldMap = {}; this.emitter.removeAllListeners(); - this.disposeFunctions.forEach(f => f()); + this.disposeFunctions.forEach((f) => f()); this.disposeFunctions = []; } @@ -253,21 +260,15 @@ export class SettingTopEntry implements ISettingTopEntry { } // ==== copy some Node api ===== - getStatus() { + getStatus() {} - } - - setStatus() { - - } + setStatus() {} getChildren() { // this.nodes.map() } - getDOMNode() { - - } + getDOMNode() {} getId() { return this.id; diff --git a/packages/designer/src/designer/setting/utils.ts b/packages/designer/src/designer/setting/utils.ts index 75ed1dfc1a..3a6051ce23 100644 --- a/packages/designer/src/designer/setting/utils.ts +++ b/packages/designer/src/designer/setting/utils.ts @@ -1,11 +1,11 @@ // all this file for polyfill vision logic import { isValidElement } from 'react'; -import { IPublicTypeFieldConfig, IPublicTypeSetterConfig } from '@alilc/lowcode-types'; -import { isSetterConfig, isDynamicSetter } from '@alilc/lowcode-utils'; +import { IPublicTypeFieldConfig, IPublicTypeSetterConfig } from '@felce/lowcode-types'; +import { isSetterConfig, isDynamicSetter } from '@felce/lowcode-utils'; import { ISettingField } from './setting-field'; function getHotterFromSetter(setter) { - return setter && (setter.Hotter || (setter.type && setter.type.Hotter)) || []; // eslint-disable-line + return (setter && (setter.Hotter || (setter.type && setter.type.Hotter))) || []; // eslint-disable-line } function getTransducerFromSetter(setter) { @@ -25,8 +25,8 @@ function combineTransducer(transducer, arr, context) { } return { - toHot: (transducer && transducer.toHot || (x => x)).bind(context), // eslint-disable-line - toNative: (transducer && transducer.toNative || (x => x)).bind(context), // eslint-disable-line + toHot: ((transducer && transducer.toHot) || ((x) => x)).bind(context), // eslint-disable-line + toNative: ((transducer && transducer.toNative) || ((x) => x)).bind(context), // eslint-disable-line }; } @@ -71,10 +71,16 @@ export class Transducer { if (isDynamicSetter(setter) && isDynamic) { try { setter = setter.call(context.internalToShellField(), context.internalToShellField()); - } catch (e) { console.error(e); } + } catch (e) { + console.error(e); + } } - this.setterTransducer = combineTransducer(getTransducerFromSetter(setter), getHotterFromSetter(setter), context); + this.setterTransducer = combineTransducer( + getTransducerFromSetter(setter), + getHotterFromSetter(setter), + context, + ); this.context = context; } diff --git a/packages/designer/src/document/document-model.ts b/packages/designer/src/document/document-model.ts index edca8fd818..e6d5636159 100644 --- a/packages/designer/src/document/document-model.ts +++ b/packages/designer/src/document/document-model.ts @@ -7,7 +7,7 @@ import { wrapWithEventSwitch, createModuleEventBus, IEventBus, -} from '@alilc/lowcode-editor-core'; +} from '@felce/lowcode-editor-core'; import { IPublicTypeNodeData, IPublicTypeNodeSchema, @@ -19,13 +19,9 @@ import { IPublicEnumTransformStage, IPublicTypeOnChangeOptions, IPublicTypeDisposable, -} from '@alilc/lowcode-types'; -import type { - IPublicTypeRootSchema, -} from '@alilc/lowcode-types'; -import type { - IDropLocation, -} from '@alilc/lowcode-designer'; +} from '@felce/lowcode-types'; +import type { IPublicTypeRootSchema } from '@felce/lowcode-types'; +import type { IDropLocation } from '@felce/lowcode-designer'; import { uniqueId, isPlainObject, @@ -36,7 +32,7 @@ import { isDragNodeObject, isDragNodeDataObject, isNode, -} from '@alilc/lowcode-utils'; +} from '@felce/lowcode-utils'; import { IProject } from '../project'; import { ISimulatorHost } from '../simulator'; import type { IComponentMeta } from '../component-meta'; @@ -50,37 +46,38 @@ import { EDITOR_EVENT } from '../types'; export type GetDataType<T, NodeType> = T extends undefined ? NodeType extends { - schema: infer R; - } - ? R - : any + schema: infer R; + } + ? R + : any : T; -export interface IDocumentModel extends Omit<IPublicModelDocumentModel< - ISelection, - IHistory, - INode, - IDropLocation, - IModalNodesManager, - IProject ->, - 'detecting' | - 'checkNesting' | - 'getNodeById' | - // 以下属性在内部的 document 中不存在 - 'exportSchema' | - 'importSchema' | - 'onAddNode' | - 'onRemoveNode' | - 'onChangeDetecting' | - 'onChangeSelection' | - 'onChangeNodeProp' | - 'onImportSchema' | - 'isDetectingNode' | - 'onFocusNodeChanged' | - 'onDropLocationChanged' -> { - +export interface IDocumentModel + extends Omit< + IPublicModelDocumentModel< + ISelection, + IHistory, + INode, + IDropLocation, + IModalNodesManager, + IProject + >, + | 'detecting' + | 'checkNesting' + | 'getNodeById' + // 以下属性在内部的 document 中不存在 + | 'exportSchema' + | 'importSchema' + | 'onAddNode' + | 'onRemoveNode' + | 'onChangeDetecting' + | 'onChangeSelection' + | 'onChangeNodeProp' + | 'onImportSchema' + | 'isDetectingNode' + | 'onFocusNodeChanged' + | 'onDropLocationChanged' + > { readonly designer: IDesigner; selection: ISelection; @@ -115,7 +112,11 @@ export interface IDocumentModel extends Omit<IPublicModelDocumentModel< checkNesting( dropTarget: INode, - dragObject: IPublicTypeDragNodeObject | IPublicTypeNodeSchema | INode | IPublicTypeDragNodeDataObject, + dragObject: + | IPublicTypeDragNodeObject + | IPublicTypeNodeSchema + | INode + | IPublicTypeDragNodeDataObject, ): boolean; getNodeCount(): number; @@ -138,7 +139,12 @@ export interface IDocumentModel extends Omit<IPublicModelDocumentModel< getComponentMeta(componentName: string): IComponentMeta; - insertNodes(parent: INode, thing: INode[] | IPublicTypeNodeData[], at?: number | null, copy?: boolean): INode[]; + insertNodes( + parent: INode, + thing: INode[] | IPublicTypeNodeData[], + at?: number | null, + copy?: boolean, + ): INode[]; open(): IDocumentModel; @@ -253,10 +259,10 @@ export class DocumentModel implements IDocumentModel { set dropLocation(loc: IDropLocation | null) { this._dropLocation = loc; // pub event - this.designer.editor.eventBus.emit( - 'document.dropLocation.changed', - { document: this, location: loc }, - ); + this.designer.editor.eventBus.emit('document.dropLocation.changed', { + document: this, + location: loc, + }); } /** @@ -356,7 +362,9 @@ export class DocumentModel implements IDocumentModel { }; } - onChangeNodeChildren(fn: (info: IPublicTypeOnChangeOptions<INode>) => void): IPublicTypeDisposable { + onChangeNodeChildren( + fn: (info: IPublicTypeOnChangeOptions<INode>) => void, + ): IPublicTypeDisposable { this.designer.editor?.eventBus.on(EDITOR_EVENT.NODE_CHILDREN_CHANGE, fn); return () => { @@ -475,14 +483,24 @@ export class DocumentModel implements IDocumentModel { /** * 插入一个节点 */ - insertNode(parent: INode, thing: INode | IPublicTypeNodeData, at?: number | null, copy?: boolean): INode | null { + insertNode( + parent: INode, + thing: INode | IPublicTypeNodeData, + at?: number | null, + copy?: boolean, + ): INode | null { return insertChild(parent, thing, at, copy); } /** * 插入多个节点 */ - insertNodes(parent: INode, thing: INode[] | IPublicTypeNodeData[], at?: number | null, copy?: boolean) { + insertNodes( + parent: INode, + thing: INode[] | IPublicTypeNodeData[], + at?: number | null, + copy?: boolean, + ) { return insertChildren(parent, thing, at, copy); } @@ -547,7 +565,7 @@ export class DocumentModel implements IDocumentModel { const drillDownNodeId = this._drillDownNode?.id; runWithGlobalEventOff(() => { // TODO: 暂时用饱和式删除,原因是 Slot 节点并不是树节点,无法正常递归删除 - this.nodes.forEach(node => { + this.nodes.forEach((node) => { if (node.isRoot()) return; this.internalRemoveAndPurgeNode(node, true); }); @@ -560,14 +578,20 @@ export class DocumentModel implements IDocumentModel { }); } - export(stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Serilize): IPublicTypeRootSchema | undefined { + export( + stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Serilize, + ): IPublicTypeRootSchema | undefined { stage = compatStage(stage); // 置顶只作用于 Page 的第一级子节点,目前还用不到里层的置顶;如果后面有需要可以考虑将这段写到 node-children 中的 export const currentSchema = this.rootNode?.export<IPublicTypeRootSchema>(stage); - if (Array.isArray(currentSchema?.children) && currentSchema?.children?.length && currentSchema?.children?.length > 0) { + if ( + Array.isArray(currentSchema?.children) && + currentSchema?.children?.length && + currentSchema?.children?.length > 0 + ) { const FixedTopNodeIndex = currentSchema?.children - .filter(i => isPlainObject(i)) - .findIndex((i => (i as IPublicTypeNodeSchema).props?.__isTopFixed__)); + .filter((i) => isPlainObject(i)) + .findIndex((i) => (i as IPublicTypeNodeSchema).props?.__isTopFixed__); if (FixedTopNodeIndex > 0) { const FixedTopNode = currentSchema?.children.splice(FixedTopNodeIndex, 1); currentSchema?.children.unshift(FixedTopNode[0]); @@ -672,7 +696,11 @@ export class DocumentModel implements IDocumentModel { checkNesting( dropTarget: INode, - dragObject: IPublicTypeDragNodeObject | IPublicTypeNodeSchema | INode | IPublicTypeDragNodeDataObject, + dragObject: + | IPublicTypeDragNodeObject + | IPublicTypeNodeSchema + | INode + | IPublicTypeDragNodeDataObject, ): boolean { let items: Array<INode | IPublicTypeNodeSchema>; if (isDragNodeDataObject(dragObject)) { @@ -685,7 +713,9 @@ export class DocumentModel implements IDocumentModel { console.warn('the dragObject is not in the correct type, dragObject:', dragObject); return true; } - return items.every((item) => this.checkNestingDown(dropTarget, item) && this.checkNestingUp(dropTarget, item)); + return items.every( + (item) => this.checkNestingDown(dropTarget, item) && this.checkNestingUp(dropTarget, item), + ); } /** @@ -693,7 +723,10 @@ export class DocumentModel implements IDocumentModel { * Will be deleted in version 2.0.0. * Use checkNesting method instead. */ - checkDropTarget(dropTarget: INode, dragObject: IPublicTypeDragNodeObject | IPublicTypeDragNodeDataObject): boolean { + checkDropTarget( + dropTarget: INode, + dragObject: IPublicTypeDragNodeObject | IPublicTypeDragNodeDataObject, + ): boolean { let items: Array<INode | IPublicTypeNodeSchema>; if (isDragNodeDataObject(dragObject)) { items = Array.isArray(dragObject.data) ? dragObject.data : [dragObject.data]; @@ -760,7 +793,7 @@ export class DocumentModel implements IDocumentModel { /** * @deprecated - */ + */ /* istanbul ignore next */ exportAddonData() { const addons: { @@ -796,10 +829,7 @@ export class DocumentModel implements IDocumentModel { } /* istanbul ignore next */ - acceptRootNodeVisitor( - visitorName = 'default', - visitorFn: (node: IRootNode) => any, - ) { + acceptRootNodeVisitor(visitorName = 'default', visitorFn: (node: IRootNode) => any) { let visitorResult = {}; if (!visitorName) { /* eslint-disable-next-line no-console */ diff --git a/packages/designer/src/document/document-view.tsx b/packages/designer/src/document/document-view.tsx index c6dbe76a81..1c42ce6a63 100644 --- a/packages/designer/src/document/document-view.tsx +++ b/packages/designer/src/document/document-view.tsx @@ -1,6 +1,6 @@ import { Component } from 'react'; import classNames from 'classnames'; -import { observer } from '@alilc/lowcode-editor-core'; +import { observer } from '@felce/lowcode-editor-core'; import { DocumentModel, IDocumentModel } from './document-model'; import { BuiltinSimulatorHostView } from '../builtin-simulator'; diff --git a/packages/designer/src/document/history.ts b/packages/designer/src/document/history.ts index ca288c03a8..fa1badffc2 100644 --- a/packages/designer/src/document/history.ts +++ b/packages/designer/src/document/history.ts @@ -1,6 +1,10 @@ -import { reaction, untracked, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core'; -import { IPublicTypeNodeSchema, IPublicModelHistory, IPublicTypeDisposable } from '@alilc/lowcode-types'; -import { Logger } from '@alilc/lowcode-utils'; +import { reaction, untracked, IEventBus, createModuleEventBus } from '@felce/lowcode-editor-core'; +import { + IPublicTypeNodeSchema, + IPublicModelHistory, + IPublicTypeDisposable, +} from '@felce/lowcode-types'; +import { Logger } from '@felce/lowcode-utils'; import { IDocumentModel } from '../designer'; const logger = new Logger({ level: 'warn', bizName: 'history' }); @@ -41,41 +45,45 @@ export class History<T = IPublicTypeNodeSchema> implements IHistory { private timeGap: number = 1000; constructor( - dataFn: () => T | null, - private redoer: (data: T) => void, - private document?: IDocumentModel, - ) { + dataFn: () => T | null, + private redoer: (data: T) => void, + private document?: IDocumentModel, + ) { this.session = new Session(0, null, this.timeGap); this.records = [this.session]; - reaction((): any => { - return dataFn(); - }, (data: T) => { - if (this.asleep) return; - untracked(() => { - const log = this.currentSerialization.serialize(data); - - // do not record unchanged data - if (this.session.data === log) { - return; - } - - if (this.session.isActive()) { - this.session.log(log); - } else { - this.session.end(); - const lastState = this.getState(); - const cursor = this.session.cursor + 1; - const session = new Session(cursor, log, this.timeGap); - this.session = session; - this.records.splice(cursor, this.records.length - cursor, session); - const currentState = this.getState(); - if (currentState !== lastState) { - this.emitter.emit('statechange', currentState); + reaction( + (): any => { + return dataFn(); + }, + (data: T) => { + if (this.asleep) return; + untracked(() => { + const log = this.currentSerialization.serialize(data); + + // do not record unchanged data + if (this.session.data === log) { + return; } - } - }); - }, { fireImmediately: true }); + + if (this.session.isActive()) { + this.session.log(log); + } else { + this.session.end(); + const lastState = this.getState(); + const cursor = this.session.cursor + 1; + const session = new Session(cursor, log, this.timeGap); + this.session = session; + this.records.splice(cursor, this.records.length - cursor, session); + const currentState = this.getState(); + if (currentState !== lastState) { + this.emitter.emit('statechange', currentState); + } + } + }); + }, + { fireImmediately: true }, + ); } setSerialization(serialization: Serialization<T, string>) { @@ -242,7 +250,11 @@ export class Session { return this._data; } - constructor(readonly cursor: number, data: any, private timeGap: number = 1000) { + constructor( + readonly cursor: number, + data: any, + private timeGap: number = 1000, + ) { this.setTimer(); this.log(data); } diff --git a/packages/designer/src/document/node/exclusive-group.ts b/packages/designer/src/document/node/exclusive-group.ts index 9f57b12fc7..10c324b374 100644 --- a/packages/designer/src/document/node/exclusive-group.ts +++ b/packages/designer/src/document/node/exclusive-group.ts @@ -1,6 +1,6 @@ -import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core'; -import { uniqueId } from '@alilc/lowcode-utils'; -import { IPublicTypeTitleContent, IPublicModelExclusiveGroup } from '@alilc/lowcode-types'; +import { obx, computed, makeObservable } from '@felce/lowcode-editor-core'; +import { uniqueId } from '@felce/lowcode-utils'; +import { IPublicTypeTitleContent, IPublicModelExclusiveGroup } from '@felce/lowcode-types'; import type { INode } from './node'; import { intl } from '../../locale'; @@ -58,7 +58,10 @@ export class ExclusiveGroup implements IExclusiveGroup { return this.firstNode.index; } - constructor(readonly name: string, title?: IPublicTypeTitleContent) { + constructor( + readonly name: string, + title?: IPublicTypeTitleContent, + ) { makeObservable(this); this.title = title || { type: 'i18n', diff --git a/packages/designer/src/document/node/modal-nodes-manager.ts b/packages/designer/src/document/node/modal-nodes-manager.ts index 21c31ab46a..b906a2422d 100644 --- a/packages/designer/src/document/node/modal-nodes-manager.ts +++ b/packages/designer/src/document/node/modal-nodes-manager.ts @@ -1,7 +1,7 @@ import { INode } from './node'; import { DocumentModel } from '../document-model'; -import { IPublicModelModalNodesManager } from '@alilc/lowcode-types'; -import { createModuleEventBus, IEventBus } from '@alilc/lowcode-editor-core'; +import { IPublicModelModalNodesManager } from '@felce/lowcode-types'; +import { createModuleEventBus, IEventBus } from '@felce/lowcode-editor-core'; export function getModalNodes(node: INode) { if (!node) return []; @@ -18,8 +18,7 @@ export function getModalNodes(node: INode) { return nodes; } -export interface IModalNodesManager extends IPublicModelModalNodesManager<INode> { -} +export interface IModalNodesManager extends IPublicModelModalNodesManager<INode> {} export class ModalNodesManager implements IModalNodesManager { willDestroy: any; @@ -107,10 +106,9 @@ export class ModalNodesManager implements IModalNodesManager { } private addNodeEvent(node: INode) { - this.nodeRemoveEvents[node.id] = - node.onVisibleChange(() => { - this.emitter.emit('visibleChange'); - }); + this.nodeRemoveEvents[node.id] = node.onVisibleChange(() => { + this.emitter.emit('visibleChange'); + }); } private removeNodeEvent(node: INode) { diff --git a/packages/designer/src/document/node/node-children.ts b/packages/designer/src/document/node/node-children.ts index 65210fe62c..70b0c0ef6d 100644 --- a/packages/designer/src/document/node/node-children.ts +++ b/packages/designer/src/document/node/node-children.ts @@ -1,7 +1,18 @@ -import { obx, computed, makeObservable, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core'; +import { + obx, + computed, + makeObservable, + IEventBus, + createModuleEventBus, +} from '@felce/lowcode-editor-core'; import { Node, INode } from './node'; -import { IPublicTypeNodeData, IPublicModelNodeChildren, IPublicEnumTransformStage, IPublicTypeDisposable } from '@alilc/lowcode-types'; -import { shallowEqual, compatStage, isNodeSchema } from '@alilc/lowcode-utils'; +import { + IPublicTypeNodeData, + IPublicModelNodeChildren, + IPublicEnumTransformStage, + IPublicTypeDisposable, +} from '@felce/lowcode-types'; +import { shallowEqual, compatStage, isNodeSchema } from '@felce/lowcode-utils'; import { foreachReverse } from '../../utils/tree'; import { NodeRemoveOptions } from '../../types'; @@ -10,12 +21,11 @@ export interface IOnChangeOptions { node: Node; } -export interface INodeChildren extends Omit<IPublicModelNodeChildren<INode>, - 'importSchema' | - 'exportSchema' | - 'isEmpty' | - 'notEmpty' -> { +export interface INodeChildren + extends Omit< + IPublicModelNodeChildren<INode>, + 'importSchema' | 'exportSchema' | 'isEmpty' | 'notEmpty' + > { children: INode[]; get owner(): INode; @@ -28,11 +38,11 @@ export interface INodeChildren extends Omit<IPublicModelNodeChildren<INode>, * 删除一个节点 */ internalDelete( - node: INode, - purge: boolean, - useMutator: boolean, - options: NodeRemoveOptions - ): boolean; + node: INode, + purge: boolean, + useMutator: boolean, + options: NodeRemoveOptions, + ): boolean; /** * 插入一个节点,返回新长度 @@ -97,14 +107,16 @@ export class NodeChildren implements INodeChildren { } constructor( - readonly owner: INode, - data: IPublicTypeNodeData | IPublicTypeNodeData[], - options: any = {}, - ) { + readonly owner: INode, + data: IPublicTypeNodeData | IPublicTypeNodeData[], + options: any = {}, + ) { makeObservable(this); - this.children = (Array.isArray(data) ? data : [data]).filter(child => !!child).map((child) => { - return this.owner.document?.createNode(child, options.checkId); - }); + this.children = (Array.isArray(data) ? data : [data]) + .filter((child) => !!child) + .map((child) => { + return this.owner.document?.createNode(child, options.checkId); + }); } internalInitParent() { @@ -127,7 +139,7 @@ export class NodeChildren implements INodeChildren { } import(data?: IPublicTypeNodeData | IPublicTypeNodeData[], checkId = false) { - data = (data ? (Array.isArray(data) ? data : [data]) : []).filter(d => !!d); + data = (data ? (Array.isArray(data) ? data : [data]) : []).filter((d) => !!d); const originChildren = this.children.slice(); this.children.forEach((child) => child.internalSetParent(null)); @@ -187,7 +199,7 @@ export class NodeChildren implements INodeChildren { } unlinkChild(node: INode) { - const i = this.children.map(d => d.id).indexOf(node.id); + const i = this.children.map((d) => d.id).indexOf(node.id); if (i < 0) { return false; } @@ -208,7 +220,12 @@ export class NodeChildren implements INodeChildren { /** * 删除一个节点 */ - internalDelete(node: INode, purge = false, useMutator = true, options: NodeRemoveOptions = {}): boolean { + internalDelete( + node: INode, + purge = false, + useMutator = true, + options: NodeRemoveOptions = {}, + ): boolean { node.internalPurgeStart(); if (node.isParentalNode) { foreachReverse( @@ -227,7 +244,7 @@ export class NodeChildren implements INodeChildren { ); } // 需要在从 children 中删除 node 前记录下 index,internalSetParent 中会执行删除 (unlink) 操作 - const i = this.children.map(d => d.id).indexOf(node.id); + const i = this.children.map((d) => d.id).indexOf(node.id); if (purge) { // should set parent null node.internalSetParent(null, useMutator); @@ -275,7 +292,7 @@ export class NodeChildren implements INodeChildren { const { children } = this; let index = at == null || at === -1 ? children.length : at; - const i = children.map(d => d.id).indexOf(node.id); + const i = children.map((d) => d.id).indexOf(node.id); if (node.parent) { const editor = node.document?.designer.editor; @@ -344,7 +361,7 @@ export class NodeChildren implements INodeChildren { * 取得节点索引编号 */ indexOf(node: INode): number { - return this.children.map(d => d.id).indexOf(node.id); + return this.children.map((d) => d.id).indexOf(node.id); } /** @@ -446,7 +463,7 @@ export class NodeChildren implements INodeChildren { const willRemove = this.children.filter(remover); if (willRemove.length > 0) { willRemove.forEach((node) => { - const i = this.children.map(d => d.id).indexOf(node.id); + const i = this.children.map((d) => d.id).indexOf(node.id); if (i > -1) { this.children.splice(i, 1); node.remove(false); diff --git a/packages/designer/src/document/node/node.ts b/packages/designer/src/document/node/node.ts index c8363d0586..f3c61fe0df 100644 --- a/packages/designer/src/document/node/node.ts +++ b/packages/designer/src/document/node/node.ts @@ -1,5 +1,15 @@ import { ReactElement } from 'react'; -import { obx, computed, autorun, makeObservable, runInAction, wrapWithEventSwitch, action, createModuleEventBus, IEventBus } from '@alilc/lowcode-editor-core'; +import { + obx, + computed, + autorun, + makeObservable, + runInAction, + wrapWithEventSwitch, + action, + createModuleEventBus, + IEventBus, +} from '@felce/lowcode-editor-core'; import { IPublicTypeNodeSchema, IPublicTypePropsMap, @@ -17,9 +27,9 @@ import { IPublicEnumTransformStage, IPublicTypeDisposable, IBaseModelNode, -} from '@alilc/lowcode-types'; -import { compatStage, isDOMText, isJSExpression, isNode, isNodeSchema } from '@alilc/lowcode-utils'; -import { ISettingTopEntry } from '@alilc/lowcode-designer'; +} from '@felce/lowcode-types'; +import { compatStage, isDOMText, isJSExpression, isNode, isNodeSchema } from '@felce/lowcode-utils'; +import { ISettingTopEntry } from '@felce/lowcode-designer'; import { Props, getConvertedExtraKey, IProps } from './props/props'; import type { IDocumentModel } from '../document-model'; import { NodeChildren, INodeChildren } from './node-children'; @@ -37,34 +47,36 @@ export interface NodeStatus { inPlaceEditing: boolean; } -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' -> { +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; @@ -112,7 +124,9 @@ export interface IBaseNode<Schema extends IPublicTypeNodeSchema = IPublicTypeNod getSuitablePlace(node: INode, ref: any): any; - onChildrenChange(fn: (param?: { type: string; node: INode }) => void): IPublicTypeDisposable | undefined; + onChildrenChange( + fn: (param?: { type: string; node: INode }) => void, + ): IPublicTypeDisposable | undefined; onPropChange(func: (info: IPublicTypePropChangeOptions) => void): IPublicTypeDisposable; @@ -134,11 +148,7 @@ export interface IBaseNode<Schema extends IPublicTypeNodeSchema = IPublicTypeNod isEmpty(): boolean; - remove( - useMutator?: boolean, - purge?: boolean, - options?: NodeRemoveOptions, - ): void; + remove(useMutator?: boolean, purge?: boolean, options?: NodeRemoveOptions): void; didDropIn(dragment: INode): void; @@ -212,7 +222,9 @@ export interface IBaseNode<Schema extends IPublicTypeNodeSchema = IPublicTypeNod * isLocked * hidden */ -export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> implements IBaseNode { +export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> + implements IBaseNode +{ private emitter: IEventBus; /** @@ -368,7 +380,10 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> pseudo: false, }; - constructor(readonly document: IDocumentModel, nodeSchema: Schema) { + constructor( + readonly document: IDocumentModel, + nodeSchema: Schema, + ) { makeObservable(this); const { componentName, id, children, props, ...extras } = nodeSchema; this.id = document.nextId(id); @@ -381,10 +396,7 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> this.props = new Props(this, props, extras); this._children = new NodeChildren(this as INode, this.initialChildren(children)); this._children.internalInitParent(); - this.props.merge( - this.upgradeProps(this.initProps(props || {})), - this.upgradeProps(extras), - ); + this.props.merge(this.upgradeProps(this.initProps(props || {})), this.upgradeProps(extras)); this.setupAutoruns(); } @@ -409,12 +421,18 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> */ @action private initBuiltinProps() { - this.props.has(getConvertedExtraKey('hidden')) || this.props.add(false, getConvertedExtraKey('hidden')); - this.props.has(getConvertedExtraKey('title')) || this.props.add('', getConvertedExtraKey('title')); - this.props.has(getConvertedExtraKey('isLocked')) || this.props.add(false, getConvertedExtraKey('isLocked')); - this.props.has(getConvertedExtraKey('condition')) || this.props.add(true, getConvertedExtraKey('condition')); - this.props.has(getConvertedExtraKey('conditionGroup')) || this.props.add('', getConvertedExtraKey('conditionGroup')); - this.props.has(getConvertedExtraKey('loop')) || this.props.add(undefined, getConvertedExtraKey('loop')); + this.props.has(getConvertedExtraKey('hidden')) || + this.props.add(false, getConvertedExtraKey('hidden')); + this.props.has(getConvertedExtraKey('title')) || + this.props.add('', getConvertedExtraKey('title')); + this.props.has(getConvertedExtraKey('isLocked')) || + this.props.add(false, getConvertedExtraKey('isLocked')); + this.props.has(getConvertedExtraKey('condition')) || + this.props.add(true, getConvertedExtraKey('condition')); + this.props.has(getConvertedExtraKey('conditionGroup')) || + this.props.add('', getConvertedExtraKey('conditionGroup')); + this.props.has(getConvertedExtraKey('loop')) || + this.props.add(undefined, getConvertedExtraKey('loop')); } @action @@ -439,7 +457,9 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> }); } - private initialChildren(children: IPublicTypeNodeData | IPublicTypeNodeData[] | undefined): IPublicTypeNodeData[] { + private initialChildren( + children: IPublicTypeNodeData | IPublicTypeNodeData[] | undefined, + ): IPublicTypeNodeData[] { const { initialChildren } = this.componentMeta.advanced; if (children == null) { @@ -626,9 +646,13 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> } if (this.isSlot()) { this.parent.removeSlot(this); - this.parent.children?.internalDelete(this, purge, useMutator, { suppressRemoveEvent: true }); + this.parent.children?.internalDelete(this, purge, useMutator, { + suppressRemoveEvent: true, + }); } else { - this.parent.children?.internalDelete(this, purge, useMutator, { suppressRemoveEvent: true }); + this.parent.children?.internalDelete(this, purge, useMutator, { + suppressRemoveEvent: true, + }); } } } @@ -649,7 +673,8 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> canSelect(): boolean { const onSelectHook = this.componentMeta?.advanced?.callbacks?.onSelectHook; - const canSelect = typeof onSelectHook === 'function' ? onSelectHook(this.internalToShellNode()!) : true; + const canSelect = + typeof onSelectHook === 'function' ? onSelectHook(this.internalToShellNode()!) : true; return canSelect; } @@ -944,7 +969,10 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> /** * 导出 schema */ - export<T = IPublicTypeNodeSchema>(stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Save, options: any = {}): T { + export<T = IPublicTypeNodeSchema>( + stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Save, + options: any = {}, + ): T { stage = compatStage(stage); const baseSchema: any = { componentName: this.componentName, @@ -1098,12 +1126,11 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> */ canPerformAction(actionName: string): boolean { const availableActions = - this.componentMeta?.availableActions?.filter((action: IPublicTypeComponentAction) => { - const { condition } = action; - return typeof condition === 'function' ? - condition(this) !== false : - condition !== false; - }) + this.componentMeta?.availableActions + ?.filter((action: IPublicTypeComponentAction) => { + const { condition } = action; + return typeof condition === 'function' ? condition(this) !== false : condition !== false; + }) .map((action: IPublicTypeComponentAction) => action.name) || []; return availableActions.indexOf(actionName) >= 0; @@ -1160,7 +1187,9 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> return this.props; } - onChildrenChange(fn: (param?: { type: string; node: INode }) => void): IPublicTypeDisposable | undefined { + onChildrenChange( + fn: (param?: { type: string; node: INode }) => void, + ): IPublicTypeDisposable | undefined { const wrappedFunc = wrapWithEventSwitch(fn); return this.children?.onChange(wrappedFunc); } @@ -1230,7 +1259,7 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> const isContainerNode = this.isContainer(); const isEmptyNode = this.isEmpty(); const isRGLContainerNode = this.isRGLContainer; - const isRGLNode = (this.getParent()?.isRGLContainer) as boolean; + const isRGLNode = this.getParent()?.isRGLContainer as boolean; const isRGL = isRGLContainerNode || (isRGLNode && (!isContainerNode || !isEmptyNode)); let rglNode = isRGLContainerNode ? this : isRGL ? this?.getParent() : null; return { isContainerNode, isEmptyNode, isRGLContainerNode, isRGLNode, isRGL, rglNode }; diff --git a/packages/designer/src/document/node/props/prop.ts b/packages/designer/src/document/node/props/prop.ts index d70f0f56ec..242ccfae03 100644 --- a/packages/designer/src/document/node/props/prop.ts +++ b/packages/designer/src/document/node/props/prop.ts @@ -1,7 +1,29 @@ -import { untracked, computed, obx, engineConfig, action, makeObservable, mobx, runInAction } from '@alilc/lowcode-editor-core'; -import { GlobalEvent, IPublicEnumTransformStage } 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 { + untracked, + computed, + obx, + engineConfig, + action, + makeObservable, + mobx, + runInAction, +} from '@felce/lowcode-editor-core'; +import { GlobalEvent, IPublicEnumTransformStage } from '@felce/lowcode-types'; +import type { + IPublicTypeCompositeValue, + IPublicTypeJSSlot, + IPublicTypeSlotSchema, + IPublicModelProp, +} from '@felce/lowcode-types'; +import { + uniqueId, + isPlainObject, + hasOwnProperty, + compatStage, + isJSExpression, + isJSSlot, + isNodeSchema, +} from '@felce/lowcode-utils'; import { valueToSource } from './value-to-source'; import { IPropParent } from './props'; import type { IProps } from './props'; @@ -13,9 +35,7 @@ export const UNSET = Symbol.for('unset'); // eslint-disable-next-line no-redeclare export type UNSET = typeof UNSET; -export interface IProp extends Omit<IPublicModelProp< - INode ->, 'exportSchema' | 'node'>, IPropParent { +export interface IProp extends Omit<IPublicModelProp<INode>, 'exportSchema' | 'node'>, IPropParent { spread: boolean; key: string | number | undefined; @@ -274,7 +294,9 @@ export class Prop implements IProp, IPropParent { this.get(propName, false)?.unset(); } - export(stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Save): IPublicTypeCompositeValue { + export( + stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Save, + ): IPublicTypeCompositeValue { stage = compatStage(stage); const type = this._type; if (stage === IPublicEnumTransformStage.Render && this.key === '___condition___') { @@ -294,7 +316,7 @@ export class Prop implements IProp, IPropParent { } if (type === 'slot') { - const schema = this._slotNode?.export(stage) || {} as any; + const schema = this._slotNode?.export(stage) || ({} as any); if (stage === IPublicEnumTransformStage.Render) { return { type: 'JSSlot', @@ -372,7 +394,7 @@ export class Prop implements IProp, IPropParent { } else { this._type = 'map'; } - } else /* istanbul ignore next */ { + } /* istanbul ignore next */ else { this._type = 'expression'; this._value = { type: 'JSExpression', @@ -389,11 +411,7 @@ export class Prop implements IProp, IPropParent { } } - emitChange = ({ - oldValue, - }: { - oldValue: IPublicTypeCompositeValue | UNSET; - }) => { + emitChange = ({ oldValue }: { oldValue: IPublicTypeCompositeValue | UNSET }) => { const editor = this.owner.document?.designer.editor; const propsInfo = { key: this.key, @@ -432,7 +450,11 @@ export class Prop implements IProp, IPropParent { this._type = 'slot'; let slotSchema: IPublicTypeSlotSchema; // 当 data.value 的结构为 { componentName: 'Slot' } 时,复用部分 slotSchema 数据 - if ((isPlainObject(data.value) && isNodeSchema(data.value) && data.value?.componentName === 'Slot')) { + if ( + isPlainObject(data.value) && + isNodeSchema(data.value) && + data.value?.componentName === 'Slot' + ) { const value = data.value as IPublicTypeSlotSchema; slotSchema = { componentName: 'Slot', diff --git a/packages/designer/src/document/node/props/props.ts b/packages/designer/src/document/node/props/props.ts index 213592a5de..42f9250a8e 100644 --- a/packages/designer/src/document/node/props/props.ts +++ b/packages/designer/src/document/node/props/props.ts @@ -1,7 +1,12 @@ -import { computed, makeObservable, obx, action } from '@alilc/lowcode-editor-core'; -import { IPublicTypePropsList, IPublicTypeCompositeValue, IPublicEnumTransformStage, IBaseModelProps } from '@alilc/lowcode-types'; -import type { IPublicTypePropsMap } from '@alilc/lowcode-types'; -import { uniqueId, compatStage } from '@alilc/lowcode-utils'; +import { computed, makeObservable, obx, action } from '@felce/lowcode-editor-core'; +import { + IPublicTypePropsList, + IPublicTypeCompositeValue, + IPublicEnumTransformStage, + IBaseModelProps, +} from '@felce/lowcode-types'; +import type { IPublicTypePropsMap } from '@felce/lowcode-types'; +import { uniqueId, compatStage } from '@felce/lowcode-utils'; import { Prop, UNSET } from './prop'; import type { IProp } from './prop'; import { INode } from '../node'; @@ -27,7 +32,6 @@ export function getOriginalExtraKey(key: string): string { } export interface IPropParent { - readonly props: IProps; readonly owner: INode; @@ -37,8 +41,12 @@ export interface IPropParent { delete(prop: IProp): void; } -export interface IProps extends Omit<IBaseModelProps<IProp>, | 'getExtraProp' | 'getExtraPropValue' | 'setExtraPropValue' | 'node'>, IPropParent { - +export interface IProps + extends Omit< + IBaseModelProps<IProp>, + 'getExtraProp' | 'getExtraPropValue' | 'setExtraPropValue' | 'node' + >, + IPropParent { /** * 获取 props 对应的 node */ @@ -96,7 +104,11 @@ export class Props implements IProps, IPropParent { private purged = false; - constructor(owner: INode, value?: IPublicTypePropsMap | IPublicTypePropsList | null, extras?: ExtrasObject) { + constructor( + owner: INode, + value?: IPublicTypePropsMap | IPublicTypePropsList | null, + extras?: ExtrasObject, + ) { makeObservable(this); this.owner = owner; if (Array.isArray(value)) { diff --git a/packages/designer/src/document/node/transform-stage.ts b/packages/designer/src/document/node/transform-stage.ts index 53b72c1bf0..0e91288ba6 100644 --- a/packages/designer/src/document/node/transform-stage.ts +++ b/packages/designer/src/document/node/transform-stage.ts @@ -1 +1 @@ -export { TransformStage } from '@alilc/lowcode-types'; +export { TransformStage } from '@felce/lowcode-types'; diff --git a/packages/designer/src/document/selection.ts b/packages/designer/src/document/selection.ts index 6147e188d8..1080b068fc 100644 --- a/packages/designer/src/document/selection.ts +++ b/packages/designer/src/document/selection.ts @@ -1,7 +1,7 @@ -import { obx, makeObservable, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core'; +import { obx, makeObservable, IEventBus, createModuleEventBus } from '@felce/lowcode-editor-core'; import { INode, comparePosition, PositionNO } from './node/node'; import { DocumentModel } from './document-model'; -import { IPublicModelSelection } from '@alilc/lowcode-types'; +import { IPublicModelSelection } from '@felce/lowcode-types'; export interface ISelection extends Omit<IPublicModelSelection<INode>, 'node'> { containsNode(node: INode, excludeRoot: boolean): boolean; @@ -48,7 +48,7 @@ export class Selection implements ISelection { selectAll(ids: string[]) { const selectIds: string[] = []; - ids.forEach(d => { + ids.forEach((d) => { const node = this.doc.getNode(d); if (node?.canSelect()) { diff --git a/packages/designer/src/icons/clone.tsx b/packages/designer/src/icons/clone.tsx index 261acd2505..197c31fcce 100644 --- a/packages/designer/src/icons/clone.tsx +++ b/packages/designer/src/icons/clone.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconClone(props: IconProps) { return ( diff --git a/packages/designer/src/icons/component.tsx b/packages/designer/src/icons/component.tsx index 914f066254..7476fdb89a 100644 --- a/packages/designer/src/icons/component.tsx +++ b/packages/designer/src/icons/component.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconComponent(props: IconProps) { return ( diff --git a/packages/designer/src/icons/container.tsx b/packages/designer/src/icons/container.tsx index 6cb51fd38a..52ee34be7f 100644 --- a/packages/designer/src/icons/container.tsx +++ b/packages/designer/src/icons/container.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconContainer(props: IconProps) { return ( diff --git a/packages/designer/src/icons/hidden.tsx b/packages/designer/src/icons/hidden.tsx index ac316d1808..a85778f948 100644 --- a/packages/designer/src/icons/hidden.tsx +++ b/packages/designer/src/icons/hidden.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconHidden(props: IconProps) { return ( diff --git a/packages/designer/src/icons/lock.tsx b/packages/designer/src/icons/lock.tsx index f67fac2371..a7399932c3 100644 --- a/packages/designer/src/icons/lock.tsx +++ b/packages/designer/src/icons/lock.tsx @@ -1,9 +1,13 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconLock(props: IconProps) { return ( <SVGIcon viewBox="0 0 1024 1024" {...props}> - <path d="M704 480v-160c0-105.6-86.4-192-192-192s-192 86.4-192 192v160H160v416h704V480h-160z m-320-160c0-70.4 57.6-128 128-128s128 57.6 128 128v160h-256v-160z m416 512H224v-288h576v288z" fill="#ffffff" p-id="2680" /> + <path + d="M704 480v-160c0-105.6-86.4-192-192-192s-192 86.4-192 192v160H160v416h704V480h-160z m-320-160c0-70.4 57.6-128 128-128s128 57.6 128 128v160h-256v-160z m416 512H224v-288h576v288z" + fill="#ffffff" + p-id="2680" + /> <path d="M480 768h64v-160h-64z" fill="#ffffff" p-id="2681" /> </SVGIcon> ); diff --git a/packages/designer/src/icons/page.tsx b/packages/designer/src/icons/page.tsx index 07853c4e12..b9e2288001 100644 --- a/packages/designer/src/icons/page.tsx +++ b/packages/designer/src/icons/page.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconPage(props: IconProps) { return ( diff --git a/packages/designer/src/icons/remove.tsx b/packages/designer/src/icons/remove.tsx index 42b80f618e..7d4c7ba7e5 100644 --- a/packages/designer/src/icons/remove.tsx +++ b/packages/designer/src/icons/remove.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconRemove(props: IconProps) { return ( diff --git a/packages/designer/src/icons/setting.tsx b/packages/designer/src/icons/setting.tsx index 2df18029c3..6389a90156 100644 --- a/packages/designer/src/icons/setting.tsx +++ b/packages/designer/src/icons/setting.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconSetting(props: IconProps) { return ( diff --git a/packages/designer/src/icons/unlock.tsx b/packages/designer/src/icons/unlock.tsx index cff324920e..7b6933b790 100644 --- a/packages/designer/src/icons/unlock.tsx +++ b/packages/designer/src/icons/unlock.tsx @@ -1,9 +1,13 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconUnlock(props: IconProps) { return ( <SVGIcon viewBox="0 0 1024 1024" {...props}> - <path d="M384 480v-160c0-70.4 57.6-128 128-128s128 57.6 128 128v64h64v-64c0-105.6-86.4-192-192-192s-192 86.4-192 192v160H160v416h704V480H384z m416 352H224v-288h576v288z" fill="#ffffff" p-id="2813" /> + <path + d="M384 480v-160c0-70.4 57.6-128 128-128s128 57.6 128 128v64h64v-64c0-105.6-86.4-192-192-192s-192 86.4-192 192v160H160v416h704V480H384z m416 352H224v-288h576v288z" + fill="#ffffff" + p-id="2813" + /> <path d="M416 736h192v-64h-192z" fill="#ffffff" p-id="2814" /> </SVGIcon> ); diff --git a/packages/designer/src/locale/index.ts b/packages/designer/src/locale/index.ts index 4cb3b53cfb..33efdb0a93 100644 --- a/packages/designer/src/locale/index.ts +++ b/packages/designer/src/locale/index.ts @@ -1,4 +1,4 @@ -import { createIntl } from '@alilc/lowcode-editor-core'; +import { createIntl } from '@felce/lowcode-editor-core'; import enUS from './en-US.json'; import zhCN from './zh-CN.json'; diff --git a/packages/designer/src/plugin/plugin-context.ts b/packages/designer/src/plugin/plugin-context.ts index 7f26a2b4f3..1aa66291ef 100644 --- a/packages/designer/src/plugin/plugin-context.ts +++ b/packages/designer/src/plugin/plugin-context.ts @@ -1,5 +1,5 @@ /* eslint-disable no-multi-assign */ -import { engineConfig, createModuleEventBus } from '@alilc/lowcode-editor-core'; +import { engineConfig, createModuleEventBus } from '@felce/lowcode-editor-core'; import { IPublicApiHotkey, IPublicApiProject, @@ -20,7 +20,7 @@ import { IPublicEnumPluginRegisterLevel, IPublicModelWindow, IPublicApiCommonUI, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { IPluginContextOptions, ILowCodePluginContextApiAssembler, @@ -28,8 +28,9 @@ import { } from './plugin-types'; import { isValidPreferenceKey } from './plugin-utils'; -export default class PluginContext implements - IPublicModelPluginContext, ILowCodePluginContextPrivate { +export default class PluginContext + implements IPublicModelPluginContext, ILowCodePluginContextPrivate +{ hotkey: IPublicApiHotkey; project: IPublicApiProject; skeleton: IPublicApiSkeleton; @@ -50,9 +51,9 @@ export default class PluginContext implements isPluginRegisteredInWorkspace: false; constructor( - options: IPluginContextOptions, - contextApiAssembler: ILowCodePluginContextApiAssembler, - ) { + options: IPluginContextOptions, + contextApiAssembler: ILowCodePluginContextApiAssembler, + ) { const { pluginName = 'anonymous', meta = {} } = options; contextApiAssembler.assembleApis(this, pluginName, meta); this.pluginEvent = createModuleEventBus(pluginName, 200); @@ -62,14 +63,11 @@ export default class PluginContext implements } } - setPreference( - pluginName: string, - preferenceDeclaration: IPublicTypePluginDeclaration, - ): void { + setPreference(pluginName: string, preferenceDeclaration: IPublicTypePluginDeclaration): void { const getPreferenceValue = ( key: string, defaultValue?: IPublicTypePreferenceValueType, - ): IPublicTypePreferenceValueType | undefined => { + ): IPublicTypePreferenceValueType | undefined => { if (!isValidPreferenceKey(key, preferenceDeclaration)) { return undefined; } diff --git a/packages/designer/src/plugin/plugin-manager.ts b/packages/designer/src/plugin/plugin-manager.ts index f6b325dc0d..c7e2fea452 100644 --- a/packages/designer/src/plugin/plugin-manager.ts +++ b/packages/designer/src/plugin/plugin-manager.ts @@ -1,5 +1,5 @@ -import { engineConfig } from '@alilc/lowcode-editor-core'; -import { getLogger } from '@alilc/lowcode-utils'; +import { engineConfig } from '@felce/lowcode-editor-core'; +import { getLogger } from '@felce/lowcode-utils'; import { ILowCodePluginRuntime, ILowCodePluginManager, @@ -18,12 +18,30 @@ import { IPublicTypePluginRegisterOptions, IPublicTypePreferenceValueType, IPublicTypePlugin, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; const logger = getLogger({ level: 'warn', bizName: 'designer:pluginManager' }); // 保留的事件前缀 -const RESERVED_EVENT_PREFIX = ['designer', 'editor', 'skeleton', 'renderer', 'render', 'utils', 'plugin', 'engine', 'editor-core', 'engine-core', 'plugins', 'event', 'events', 'log', 'logger', 'ctx', 'context']; +const RESERVED_EVENT_PREFIX = [ + 'designer', + 'editor', + 'skeleton', + 'renderer', + 'render', + 'utils', + 'plugin', + 'engine', + 'editor-core', + 'engine-core', + 'plugins', + 'event', + 'events', + 'log', + 'logger', + 'ctx', + 'context', +]; export class LowCodePluginManager implements ILowCodePluginManager { private plugins: ILowCodePluginRuntime[] = []; @@ -35,7 +53,10 @@ export class LowCodePluginManager implements ILowCodePluginManager { contextApiAssembler: ILowCodePluginContextApiAssembler; - constructor(contextApiAssembler: ILowCodePluginContextApiAssembler, readonly viewName = 'global') { + constructor( + contextApiAssembler: ILowCodePluginContextApiAssembler, + readonly viewName = 'global', + ) { this.contextApiAssembler = contextApiAssembler; } @@ -79,22 +100,28 @@ export class LowCodePluginManager implements ILowCodePluginManager { const isReservedPrefix = RESERVED_EVENT_PREFIX.find((item) => item === eventPrefix); if (isReservedPrefix) { meta.eventPrefix = undefined; - logger.warn(`plugin ${pluginName} is trying to use ${eventPrefix} as event prefix, which is a reserved event prefix, please use another one`); + logger.warn( + `plugin ${pluginName} is trying to use ${eventPrefix} as event prefix, which is a reserved event prefix, please use another one`, + ); } const ctx = this._getLowCodePluginContext({ pluginName, meta }); - const customFilterValidOptions = engineConfig.get('customPluginFilterOptions', filterValidOptions); + const customFilterValidOptions = engineConfig.get( + 'customPluginFilterOptions', + filterValidOptions, + ); const pluginTransducer = engineConfig.get('customPluginTransducer', null); - const newPluginModel = pluginTransducer ? await pluginTransducer(pluginModel, ctx, options) : pluginModel; - const newOptions = customFilterValidOptions(options, newPluginModel.meta?.preferenceDeclaration); + const newPluginModel = pluginTransducer + ? await pluginTransducer(pluginModel, ctx, options) + : pluginModel; + const newOptions = customFilterValidOptions( + options, + newPluginModel.meta?.preferenceDeclaration, + ); const config = newPluginModel(ctx, newOptions); // compat the legacy way to declare pluginName // @ts-ignore pluginName = pluginName || config.name; - invariant( - pluginName, - 'pluginConfigCreator.pluginName required', - config, - ); + invariant(pluginName, 'pluginConfigCreator.pluginName required', config); ctx.setPreference(pluginName, preferenceDeclaration); @@ -119,7 +146,11 @@ export class LowCodePluginManager implements ILowCodePluginManager { const engineVersionExp = engines && engines.lowcodeEngine; if (engineVersionExp && !this.isEngineVersionMatched(engineVersionExp)) { - throw new Error(`plugin ${pluginName} skipped, engine check failed, current engine version is ${engineConfig.get('ENGINE_VERSION')}, meta.engines.lowcodeEngine is ${engineVersionExp}`); + throw new Error( + `plugin ${pluginName} skipped, engine check failed, current engine version is ${engineConfig.get( + 'ENGINE_VERSION', + )}, meta.engines.lowcodeEngine is ${engineVersionExp}`, + ); } const plugin = new LowCodePluginRuntime(pluginName, this, config, meta); @@ -188,7 +219,9 @@ export class LowCodePluginManager implements ILowCodePluginManager { return this.pluginsMap.size; } - getPluginPreference(pluginName: string): Record<string, IPublicTypePreferenceValueType> | null | undefined { + getPluginPreference( + pluginName: string, + ): Record<string, IPublicTypePreferenceValueType> | null | undefined { if (!this.pluginPreference) { return null; } diff --git a/packages/designer/src/plugin/plugin-types.ts b/packages/designer/src/plugin/plugin-types.ts index cfc38866f5..6c3f5639fc 100644 --- a/packages/designer/src/plugin/plugin-types.ts +++ b/packages/designer/src/plugin/plugin-types.ts @@ -20,7 +20,7 @@ import { IPublicEnumPluginRegisterLevel, IPublicApiCommonUI, IPublicApiCommand, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import PluginContext from './plugin-context'; export type PluginPreference = Map<string, Record<string, IPublicTypePreferenceValueType>>; @@ -44,7 +44,8 @@ interface ILowCodePluginRuntimeExportsAccessor { } // eslint-disable-next-line max-len -export type ILowCodePluginRuntime = ILowCodePluginRuntimeCore & ILowCodePluginRuntimeExportsAccessor; +export type ILowCodePluginRuntime = ILowCodePluginRuntimeCore & + ILowCodePluginRuntimeExportsAccessor; export interface ILowCodePluginContextPrivate { set hotkey(hotkey: IPublicApiHotkey); @@ -84,14 +85,16 @@ export interface ILowCodePluginManagerCore { pluginOptions?: any, options?: IPublicTypePluginRegisterOptions, ): Promise<void>; - init(pluginPreference?: Map<string, Record<string, IPublicTypePreferenceValueType>>): Promise<void>; + init( + pluginPreference?: Map<string, Record<string, IPublicTypePreferenceValueType>>, + ): Promise<void>; get(pluginName: string): ILowCodePluginRuntime | undefined; getAll(): ILowCodePluginRuntime[]; has(pluginName: string): boolean; delete(pluginName: string): any; setDisabled(pluginName: string, flag: boolean): void; dispose(): void; - _getLowCodePluginContext (options: IPluginContextOptions): PluginContext; + _getLowCodePluginContext(options: IPluginContextOptions): PluginContext; } export type ILowCodePluginManager = ILowCodePluginManagerCore & ILowCodePluginManagerPluginAccessor; diff --git a/packages/designer/src/plugin/plugin-utils.ts b/packages/designer/src/plugin/plugin-utils.ts index 7d8ab8db9c..d41b9afecb 100644 --- a/packages/designer/src/plugin/plugin-utils.ts +++ b/packages/designer/src/plugin/plugin-utils.ts @@ -1,5 +1,8 @@ import { isPlainObject } from 'lodash'; -import { IPublicTypePluginRegisterOptions, IPublicTypePluginDeclaration } from '@alilc/lowcode-types'; +import { + IPublicTypePluginRegisterOptions, + IPublicTypePluginDeclaration, +} from '@felce/lowcode-types'; export function isValidPreferenceKey( key: string, @@ -17,10 +20,7 @@ export function isLowCodeRegisterOptions(opts: any): opts is IPublicTypePluginRe return opts && ('autoInit' in opts || 'override' in opts); } -export function filterValidOptions( - opts: any, - preferenceDeclaration: IPublicTypePluginDeclaration, - ) { +export function filterValidOptions(opts: any, preferenceDeclaration: IPublicTypePluginDeclaration) { if (!opts || !isPlainObject(opts)) return opts; const filteredOpts = {} as any; Object.keys(opts).forEach((key) => { @@ -32,4 +32,4 @@ export function filterValidOptions( } }); return filteredOpts; -} \ No newline at end of file +} diff --git a/packages/designer/src/plugin/plugin.ts b/packages/designer/src/plugin/plugin.ts index dd57325fcd..78c2acaa64 100644 --- a/packages/designer/src/plugin/plugin.ts +++ b/packages/designer/src/plugin/plugin.ts @@ -1,12 +1,6 @@ -import { getLogger, Logger } from '@alilc/lowcode-utils'; -import { - ILowCodePluginRuntime, - ILowCodePluginManager, -} from './plugin-types'; -import { - IPublicTypePluginConfig, - IPublicTypePluginMeta, -} from '@alilc/lowcode-types'; +import { getLogger, Logger } from '@felce/lowcode-utils'; +import { ILowCodePluginRuntime, ILowCodePluginManager } from './plugin-types'; +import { IPublicTypePluginConfig, IPublicTypePluginMeta } from '@felce/lowcode-types'; import { invariant } from '../utils'; export class LowCodePluginRuntime implements ILowCodePluginRuntime { diff --git a/packages/designer/src/project/project-view.tsx b/packages/designer/src/project/project-view.tsx index a16d4451a6..6817e35053 100644 --- a/packages/designer/src/project/project-view.tsx +++ b/packages/designer/src/project/project-view.tsx @@ -1,5 +1,5 @@ import { Component } from 'react'; -import { observer, engineConfig } from '@alilc/lowcode-editor-core'; +import { observer, engineConfig } from '@felce/lowcode-editor-core'; import { Designer } from '../designer'; import { BuiltinSimulatorHostView } from '../builtin-simulator'; import './project.less'; @@ -8,7 +8,11 @@ export class BuiltinLoading extends Component { render() { return ( <div id="engine-loading-wrapper"> - <img width="154" height="100" src="https://img.alicdn.com/tfs/TB1CmVgayERMeJjy0FcXXc7opXa-308-200.gif" /> + <img + width="154" + height="100" + src="https://img.alicdn.com/tfs/TB1CmVgayERMeJjy0FcXXc7opXa-308-200.gif" + /> </div> ); } diff --git a/packages/designer/src/project/project.ts b/packages/designer/src/project/project.ts index 94913d9fa7..697b221d2d 100644 --- a/packages/designer/src/project/project.ts +++ b/packages/designer/src/project/project.ts @@ -1,41 +1,47 @@ -import { obx, computed, makeObservable, action, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core'; +import { + obx, + computed, + makeObservable, + action, + IEventBus, + createModuleEventBus, +} from '@felce/lowcode-editor-core'; import { IDesigner } from '../designer'; import { DocumentModel, isDocumentModel } from '../document'; import type { IDocumentModel } from '../document'; -import { IPublicEnumTransformStage } from '@alilc/lowcode-types'; +import { IPublicEnumTransformStage } from '@felce/lowcode-types'; import type { IBaseApiProject, IPublicTypeProjectSchema, IPublicTypeRootSchema, IPublicTypeComponentsMap, IPublicTypeSimulatorRenderer, -} from '@alilc/lowcode-types'; -import { isLowCodeComponentType, isProCodeComponentType } from '@alilc/lowcode-utils'; +} from '@felce/lowcode-types'; +import { isLowCodeComponentType, isProCodeComponentType } from '@felce/lowcode-utils'; import { ISimulatorHost } from '../simulator'; -export interface IProject extends Omit<IBaseApiProject< - IDocumentModel ->, - 'simulatorHost' | - 'importSchema' | - 'exportSchema' | - 'openDocument' | - 'getDocumentById' | - 'getCurrentDocument' | - 'addPropsTransducer' | - 'onRemoveDocument' | - 'onChangeDocument' | - 'onSimulatorHostReady' | - 'onSimulatorRendererReady' | - 'setI18n' | - 'setConfig' | - 'currentDocument' | - 'selection' | - 'documents' | - 'createDocument' | - 'getDocumentByFileName' -> { - +export interface IProject + extends Omit< + IBaseApiProject<IDocumentModel>, + | 'simulatorHost' + | 'importSchema' + | 'exportSchema' + | 'openDocument' + | 'getDocumentById' + | 'getCurrentDocument' + | 'addPropsTransducer' + | 'onRemoveDocument' + | 'onChangeDocument' + | 'onSimulatorHostReady' + | 'onSimulatorRendererReady' + | 'setI18n' + | 'setConfig' + | 'currentDocument' + | 'selection' + | 'documents' + | 'createDocument' + | 'getDocumentByFileName' + > { get designer(): IDesigner; get simulator(): ISimulatorHost | null; @@ -60,9 +66,7 @@ export interface IProject extends Omit<IBaseApiProject< load(schema?: IPublicTypeProjectSchema, autoOpen?: boolean | string): void; - getSchema( - stage?: IPublicEnumTransformStage, - ): IPublicTypeProjectSchema; + getSchema(stage?: IPublicEnumTransformStage): IPublicTypeProjectSchema; getDocument(id: string): IDocumentModel | null; @@ -136,41 +140,48 @@ export class Project implements IProject { private documentsMap = new Map<string, DocumentModel>(); - constructor(readonly designer: IDesigner, schema?: IPublicTypeProjectSchema, readonly viewName = 'global') { + constructor( + readonly designer: IDesigner, + schema?: IPublicTypeProjectSchema, + readonly viewName = 'global', + ) { makeObservable(this); this.load(schema); } private getComponentsMap(): IPublicTypeComponentsMap { - return this.documents.reduce<IPublicTypeComponentsMap>(( - componentsMap: IPublicTypeComponentsMap, - curDoc: IDocumentModel, - ): IPublicTypeComponentsMap => { - const curComponentsMap = curDoc.getComponentsMap(); - if (Array.isArray(curComponentsMap)) { - curComponentsMap.forEach((item) => { - const found = componentsMap.find((eItem) => { - if ( - isProCodeComponentType(eItem) && - isProCodeComponentType(item) && - eItem.package === item.package && - eItem.componentName === item.componentName - ) { - return true; - } else if ( - isLowCodeComponentType(eItem) && - eItem.componentName === item.componentName - ) { - return true; - } - return false; + return this.documents.reduce<IPublicTypeComponentsMap>( + ( + componentsMap: IPublicTypeComponentsMap, + curDoc: IDocumentModel, + ): IPublicTypeComponentsMap => { + const curComponentsMap = curDoc.getComponentsMap(); + if (Array.isArray(curComponentsMap)) { + curComponentsMap.forEach((item) => { + const found = componentsMap.find((eItem) => { + if ( + isProCodeComponentType(eItem) && + isProCodeComponentType(item) && + eItem.package === item.package && + eItem.componentName === item.componentName + ) { + return true; + } else if ( + isLowCodeComponentType(eItem) && + eItem.componentName === item.componentName + ) { + return true; + } + return false; + }); + if (found) return; + componentsMap.push(item); }); - if (found) return; - componentsMap.push(item); - }); - } - return componentsMap; - }, [] as IPublicTypeComponentsMap); + } + return componentsMap; + }, + [] as IPublicTypeComponentsMap, + ); } /** @@ -184,7 +195,7 @@ export class Project implements IProject { componentsMap: this.getComponentsMap(), componentsTree: this.documents .filter((doc) => !doc.isBlank()) - .map((doc) => doc.export(stage) || {} as IPublicTypeRootSchema), + .map((doc) => doc.export(stage) || ({} as IPublicTypeRootSchema)), i18n: this.i18n, }; } @@ -319,7 +330,9 @@ export class Project implements IProject { return doc.open(); } if (typeof doc === 'string' || typeof doc === 'number') { - const got = this.documents.find((item) => item.fileName === String(doc) || String(item.id) === String(doc)); + const got = this.documents.find( + (item) => item.fileName === String(doc) || String(item.id) === String(doc), + ); if (got) { return got.open(); } diff --git a/packages/designer/src/simulator.ts b/packages/designer/src/simulator.ts index 3a63a685b8..ebb907516b 100644 --- a/packages/designer/src/simulator.ts +++ b/packages/designer/src/simulator.ts @@ -1,5 +1,13 @@ import { ComponentType } from 'react'; -import { IPublicTypeComponentMetadata, IPublicTypeNodeSchema, IPublicTypeScrollable, IPublicTypeComponentInstance, IPublicModelSensor, IPublicTypeNodeInstance, IPublicTypePackage } from '@alilc/lowcode-types'; +import { + IPublicTypeComponentMetadata, + IPublicTypeNodeSchema, + IPublicTypeScrollable, + IPublicTypeComponentInstance, + IPublicModelSensor, + IPublicTypeNodeInstance, + IPublicTypePackage, +} from '@felce/lowcode-types'; import { Point, ScrollTarget, ILocateEvent, IDesigner } from './designer'; import { BuiltinSimulatorRenderer } from './builtin-simulator/renderer'; import { INode } from './document'; @@ -9,10 +17,8 @@ export type AutoFit = '100%'; // eslint-disable-next-line no-redeclare export const AutoFit = '100%'; -export interface IScrollable extends IPublicTypeScrollable { -} +export interface IScrollable extends IPublicTypeScrollable {} export interface IViewport extends IScrollable { - /** * 视口大小 */ @@ -164,13 +170,22 @@ export interface ISimulatorHost<P = object> extends IPublicModelSensor<INode> { */ getComponentContext(node: INode): object | null; - getClosestNodeInstance(from: IPublicTypeComponentInstance, specId?: string): IPublicTypeNodeInstance | null; + getClosestNodeInstance( + from: IPublicTypeComponentInstance, + specId?: string, + ): IPublicTypeNodeInstance | null; computeRect(node: INode): DOMRect | null; - computeComponentInstanceRect(instance: IPublicTypeComponentInstance, selector?: string): DOMRect | null; + computeComponentInstanceRect( + instance: IPublicTypeComponentInstance, + selector?: string, + ): DOMRect | null; - findDOMNodes(instance: IPublicTypeComponentInstance, selector?: string): Array<Element | Text> | null; + findDOMNodes( + instance: IPublicTypeComponentInstance, + selector?: string, + ): Array<Element | Text> | null; getDropContainer(e: ILocateEvent): DropContainer | null; diff --git a/packages/designer/src/transducers/index.ts b/packages/designer/src/transducers/index.ts index 48299f999c..b81e61e7ac 100644 --- a/packages/designer/src/transducers/index.ts +++ b/packages/designer/src/transducers/index.ts @@ -1,4 +1,4 @@ -import { IPublicTypeTransformedComponentMetadata as Metadata } from '@alilc/lowcode-types'; +import { IPublicTypeTransformedComponentMetadata as Metadata } from '@felce/lowcode-types'; export function legacyIssues(metadata: Metadata): Metadata { const { devMode } = metadata; diff --git a/packages/designer/src/types/index.ts b/packages/designer/src/types/index.ts index 50fd82bcd6..0e541340c5 100644 --- a/packages/designer/src/types/index.ts +++ b/packages/designer/src/types/index.ts @@ -1,4 +1,9 @@ -import { isFormEvent, compatibleLegaoSchema, getNodeSchemaById, isNodeSchema } from '@alilc/lowcode-utils'; +import { + isFormEvent, + compatibleLegaoSchema, + getNodeSchemaById, + isNodeSchema, +} from '@felce/lowcode-utils'; export type NodeRemoveOptions = { suppressRemoveEvent?: boolean; @@ -17,4 +22,4 @@ export enum EDITOR_EVENT { NODE_VISIBLE_CHANGE = 'node.visible.change', } -export type Utils = typeof utils; \ No newline at end of file +export type Utils = typeof utils; diff --git a/packages/designer/tests/bugs/prop-variable-jse.test.ts b/packages/designer/tests/bugs/prop-variable-jse.test.ts index 0f32f0b57d..ba5aae0e27 100644 --- a/packages/designer/tests/bugs/prop-variable-jse.test.ts +++ b/packages/designer/tests/bugs/prop-variable-jse.test.ts @@ -1,6 +1,6 @@ -import { Editor } from '@alilc/lowcode-editor-core'; -import { IPublicEnumTransformStage } from '@alilc/lowcode-types'; -import { isPlainObject, isVariable, isJSBlock } from '@alilc/lowcode-utils'; +import { Editor } from '@felce/lowcode-editor-core'; +import { IPublicEnumTransformStage } from '@felce/lowcode-types'; +import { isPlainObject, isVariable, isJSBlock } from '@felce/lowcode-utils'; import '../fixtures/window'; import { Designer } from '../../src/designer/designer'; import { DocumentModel } from '../../src/document/document-model'; @@ -67,6 +67,6 @@ describe('Node 方法测试', () => { expect(form.getPropValue('dataSource')).toEqual({ type: 'JSExpression', value: 'state.formData', - }) + }); }); }); diff --git a/packages/designer/tests/builtin-simulator/bem-tools/drag-resize-engine.test.ts b/packages/designer/tests/builtin-simulator/bem-tools/drag-resize-engine.test.ts index ccdc4b2b63..2491ce664a 100644 --- a/packages/designer/tests/builtin-simulator/bem-tools/drag-resize-engine.test.ts +++ b/packages/designer/tests/builtin-simulator/bem-tools/drag-resize-engine.test.ts @@ -1,5 +1,5 @@ import '../../fixtures/window'; -import { Editor, globalContext } from '@alilc/lowcode-editor-core'; +import { Editor, globalContext } from '@felce/lowcode-editor-core'; import { Project } from '../../../src/project/project'; import { DocumentModel } from '../../../src/document/document-model'; import { Designer } from '../../../src/designer/designer'; @@ -46,10 +46,9 @@ describe('DragResizeEngine 测试', () => { const offResize = resizeEngine.onResize(resizeMockFn); const offResizeEnd = resizeEngine.onResizeEnd(resizeEndMockFn); const boostedNode = doc.getNode('node_k1ow3cbn'); - const mockBoostFn = jest - .fn((e) => { - return boostedNode; - }); + const mockBoostFn = jest.fn((e) => { + return boostedNode; + }); // do nothing const noop = resizeEngine.from(); @@ -114,10 +113,9 @@ describe('DragResizeEngine 测试', () => { contentDocument: document, }); - const mockBoostFn = jest - .fn((e) => { - return doc.getNode('node_k1ow3cbn'); - }); + const mockBoostFn = jest.fn((e) => { + return doc.getNode('node_k1ow3cbn'); + }); const offFrom = resizeEngine.from(document, 'e', mockBoostFn); diff --git a/packages/designer/tests/builtin-simulator/bem-tools/manager.test.tsx b/packages/designer/tests/builtin-simulator/bem-tools/manager.test.tsx index bed1e27de9..87201d051c 100644 --- a/packages/designer/tests/builtin-simulator/bem-tools/manager.test.tsx +++ b/packages/designer/tests/builtin-simulator/bem-tools/manager.test.tsx @@ -1,5 +1,5 @@ import '../../fixtures/window'; -import { Editor } from '@alilc/lowcode-editor-core'; +import { Editor } from '@felce/lowcode-editor-core'; import { Designer } from '../../../src/designer/designer'; import { BemToolsManager } from '../../../src/builtin-simulator/bem-tools/manager'; import { shellModelFactory } from '../../../../engine/src/modules/shell-model-factory'; @@ -30,14 +30,18 @@ describe('Node 方法测试', () => { it('addBemTools / removeBemTools / getAllBemTools', () => { manager.addBemTools({ name: 't1', - item: (props: any) => { return <div />; }, + item: (props: any) => { + return <div />; + }, }); expect(manager.getAllBemTools().length).toBe(1); expect(() => { manager.addBemTools({ name: 't1', - item: (props: any) => { return <div />; }, + item: (props: any) => { + return <div />; + }, }); }).toThrow(/already exists/); @@ -47,4 +51,4 @@ describe('Node 方法测试', () => { manager.removeBemTools('t1'); expect(manager.getAllBemTools().length).toBe(0); }); -}); \ No newline at end of file +}); diff --git a/packages/designer/tests/builtin-simulator/host.test.ts b/packages/designer/tests/builtin-simulator/host.test.ts index d74c31d42c..ed4f40154e 100644 --- a/packages/designer/tests/builtin-simulator/host.test.ts +++ b/packages/designer/tests/builtin-simulator/host.test.ts @@ -5,14 +5,10 @@ import { globalContext, Hotkey as InnerHotkey, Setters as InnerSetters, -} from '@alilc/lowcode-editor-core'; -import { Workspace as InnerWorkspace } from '@alilc/lowcode-workspace'; -import { - AssetType, -} from '@alilc/lowcode-utils'; -import { - IPublicEnumDragObjectType, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-editor-core'; +import { Workspace as InnerWorkspace } from '@felce/lowcode-workspace'; +import { AssetType } from '@felce/lowcode-utils'; +import { IPublicEnumDragObjectType } from '@felce/lowcode-types'; import { Project } from '../../src/project/project'; import pageMetadata from '../fixtures/component-metadata/page'; import { Designer } from '../../src/designer/designer'; @@ -22,11 +18,13 @@ import { getMockDocument, getMockWindow, getMockEvent, delayObxTick } from '../u import { BuiltinSimulatorHost } from '../../src/builtin-simulator/host'; import { fireEvent } from '@testing-library/react'; import { shellModelFactory } from '../../../engine/src/modules/shell-model-factory'; -import { Setters, Workspace } from '@alilc/lowcode-shell'; -import { ILowCodePluginContextApiAssembler, ILowCodePluginContextPrivate, LowCodePluginManager } from '@alilc/lowcode-designer'; +import { Setters, Workspace } from '@felce/lowcode-shell'; import { - Skeleton as InnerSkeleton, -} from '@alilc/lowcode-editor-skeleton'; + ILowCodePluginContextApiAssembler, + ILowCodePluginContextPrivate, + LowCodePluginManager, +} from '@felce/lowcode-designer'; +import { Skeleton as InnerSkeleton } from '@felce/lowcode-editor-skeleton'; describe('Host 测试', () => { let editor: Editor; @@ -39,7 +37,11 @@ describe('Host 测试', () => { editor = new Editor(); const pluginContextApiAssembler: ILowCodePluginContextApiAssembler = { // eslint-disable-next-line @typescript-eslint/no-unused-vars - assembleApis: (context: ILowCodePluginContextPrivate, pluginName: string, meta: IPublicTypePluginMeta) => { + assembleApis: ( + context: ILowCodePluginContextPrivate, + pluginName: string, + meta: IPublicTypePluginMeta, + ) => { context.project = project; const eventPrefix = meta?.eventPrefix || 'common'; context.workspace = workspace; @@ -50,7 +52,7 @@ describe('Host 测试', () => { const workspace = new Workspace(innerWorkspace); const innerSkeleton = new InnerSkeleton(editor); editor.set('skeleton' as any, innerSkeleton); - editor.set('innerHotkey', new InnerHotkey()) + editor.set('innerHotkey', new InnerHotkey()); editor.set('setters', new Setters(new InnerSetters())); editor.set('innerPlugins' as any, innerPlugins); !globalContext.has(Editor) && globalContext.register(editor, Editor); @@ -219,19 +221,25 @@ describe('Host 测试', () => { }); it('findDOMNodes', () => { - host.connect({ - findDOMNodes: () => { - return null; + host.connect( + { + findDOMNodes: () => { + return null; + }, }, - }, () => {}); + () => {}, + ); expect(host.findDOMNodes()).toBeNull(); const mockElems = [document.createElement('div')]; - host.connect({ - findDOMNodes: () => { - return mockElems; + host.connect( + { + findDOMNodes: () => { + return mockElems; + }, }, - }, () => {}); + () => {}, + ); expect(host.findDOMNodes({})).toBe(mockElems); expect(host.findDOMNodes({}, 'xxx')).toBeNull(); expect(host.findDOMNodes({}, 'div')).toEqual(mockElems); @@ -245,9 +253,12 @@ describe('Host 测试', () => { docId: 'docId', }; }); - host.connect({ - getClosestNodeInstance: mockFn, - }, () => {}); + host.connect( + { + getClosestNodeInstance: mockFn, + }, + () => {}, + ); expect(host.getClosestNodeInstance()).toEqual({ node: {}, nodeId: 'id', @@ -296,8 +307,7 @@ describe('Host 测试', () => { }, }, }; - expect(host.getComponentInstances(mockNode)) - .toEqual([{ comp: true }, { comp2: true }]); + expect(host.getComponentInstances(mockNode)).toEqual([{ comp: true }, { comp2: true }]); const mockInst = { inst: true }; host.getClosestNodeInstance = () => { @@ -305,8 +315,10 @@ describe('Host 测试', () => { instance: mockInst, }; }; - expect(host.getComponentInstances(mockNode, { instance: mockInst })) - .toEqual([{ comp: true }, { comp2: true }]); + expect(host.getComponentInstances(mockNode, { instance: mockInst })).toEqual([ + { comp: true }, + { comp2: true }, + ]); }); it('setNativeSelection / setDraggingState / setCopyState / clearState', () => { @@ -314,12 +326,15 @@ describe('Host 测试', () => { const mockFn2 = jest.fn(); const mockFn3 = jest.fn(); const mockFn4 = jest.fn(); - host.connect({ - setNativeSelection: mockFn1, - setDraggingState: mockFn2, - setCopyState: mockFn3, - clearState: mockFn4, - }, () => {}); + host.connect( + { + setNativeSelection: mockFn1, + setDraggingState: mockFn2, + setCopyState: mockFn3, + clearState: mockFn4, + }, + () => {}, + ); host.setNativeSelection(true); expect(mockFn1).toHaveBeenCalledWith(true); host.setDraggingState(false); @@ -337,11 +352,14 @@ describe('Host 测试', () => { }); it('getComponent', () => { - host.connect({ - getComponent: () => { - return {}; + host.connect( + { + getComponent: () => { + return {}; + }, }, - }, () => {}); + () => {}, + ); expect(host.getComponent()).toEqual({}); expect(host.createComponent()).toBeNull(); expect(host.setSuspense()).toBeFalsy(); @@ -372,30 +390,36 @@ describe('Host 测试', () => { }); }); it('locate,没有 nodes', () => { - expect(host.locate({ - dragObject: { - type: IPublicEnumDragObjectType.Node, - nodes: [], - }, - })).toBeUndefined(); + expect( + host.locate({ + dragObject: { + type: IPublicEnumDragObjectType.Node, + nodes: [], + }, + }), + ).toBeUndefined(); }); it('locate,没有 document', () => { project.removeDocument(doc); - expect(host.locate({ - dragObject: { - type: IPublicEnumDragObjectType.Node, - nodes: [doc.getNode('page')], - }, - })).toBeNull(); + expect( + host.locate({ + dragObject: { + type: IPublicEnumDragObjectType.Node, + nodes: [doc.getNode('page')], + }, + }), + ).toBeNull(); }); it('notFoundComponent', () => { - expect(host.locate({ - dragObject: { - type: IPublicEnumDragObjectType.Node, - nodes: [doc.getNode('form')], - }, - })).toBeUndefined(); - }) + expect( + host.locate({ + dragObject: { + type: IPublicEnumDragObjectType.Node, + nodes: [doc.getNode('form')], + }, + }), + ).toBeUndefined(); + }); it('locate', () => { host.locate({ dragObject: { @@ -432,7 +456,15 @@ describe('Host 测试', () => { host.setupContextMenu(); host.getNodeInstanceFromElement = () => { return { - node: { componentMeta: { componentName: 'Button', getMetadata() { return {} } }, contains() {} }, + node: { + componentMeta: { + componentName: 'Button', + getMetadata() { + return {}; + }, + }, + contains() {}, + }, }; }; const mockFn = jest.fn(); diff --git a/packages/designer/tests/builtin-simulator/renderer.test.tsx b/packages/designer/tests/builtin-simulator/renderer.test.tsx index 776d1c948e..67a2746d8c 100644 --- a/packages/designer/tests/builtin-simulator/renderer.test.tsx +++ b/packages/designer/tests/builtin-simulator/renderer.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; import set from 'lodash/set'; import cloneDeep from 'lodash/cloneDeep'; import '../fixtures/window'; -import { Editor } from '@alilc/lowcode-editor-core'; +import { Editor } from '@felce/lowcode-editor-core'; import { Project } from '../../src/project/project'; import { Node } from '../../src/document/node/node'; import TestRenderer from 'react-test-renderer'; @@ -13,7 +13,6 @@ import formSchema from '../fixtures/schema/form'; import { getMockRenderer } from '../utils'; import { isSimulatorRenderer } from '../../src/builtin-simulator/renderer'; - describe('renderer 测试', () => { it('renderer', () => { expect(isSimulatorRenderer(getMockRenderer())).toBeTruthy(); diff --git a/packages/designer/tests/builtin-simulator/viewport.test.ts b/packages/designer/tests/builtin-simulator/viewport.test.ts index e9972fc7c3..53d044a7ab 100644 --- a/packages/designer/tests/builtin-simulator/viewport.test.ts +++ b/packages/designer/tests/builtin-simulator/viewport.test.ts @@ -1,13 +1,12 @@ import '../fixtures/window'; import { getMockWindow, getMockElement, delay } from '../utils'; -import { Editor, globalContext } from '@alilc/lowcode-editor-core'; +import { Editor, globalContext } from '@felce/lowcode-editor-core'; import { Project } from '../../src/project/project'; import { DocumentModel } from '../../src/document/document-model'; import Viewport from '../../src/builtin-simulator/viewport'; import { Designer } from '../../src/designer/designer'; import { shellModelFactory } from '../../../engine/src/modules/shell-model-factory'; - describe('Viewport 测试', () => { let editor: Editor; let designer: Designer; @@ -117,8 +116,12 @@ describe('Viewport 测试', () => { viewportElem.setHeight(300); expect(viewport.contentHeight).toBe(300 / 2); - expect(() => { viewport.scale = NaN; }).toThrow(); - expect(() => { viewport.scale = -1; }).toThrow(); + expect(() => { + viewport.scale = NaN; + }).toThrow(); + expect(() => { + viewport.scale = -1; + }).toThrow(); }); it('setScrollTarget / scrollTarget / scrolling', async () => { @@ -170,11 +173,23 @@ describe('Viewport 测试', () => { viewport = new Viewport(); viewport.mount(viewportElem); - expect(viewport.toGlobalPoint({ clientX: 100, clientY: 100 })).toEqual({ clientX: 200, clientY: 200 }); - expect(viewport.toLocalPoint({ clientX: 200, clientY: 200 })).toEqual({ clientX: 100, clientY: 100 }); + expect(viewport.toGlobalPoint({ clientX: 100, clientY: 100 })).toEqual({ + clientX: 200, + clientY: 200, + }); + expect(viewport.toLocalPoint({ clientX: 200, clientY: 200 })).toEqual({ + clientX: 100, + clientY: 100, + }); viewport.scale = 2; - expect(viewport.toGlobalPoint({ clientX: 100, clientY: 100 })).toEqual({ clientX: 300, clientY: 300 }); - expect(viewport.toLocalPoint({ clientX: 300, clientY: 300 })).toEqual({ clientX: 100, clientY: 100 }); + expect(viewport.toGlobalPoint({ clientX: 100, clientY: 100 })).toEqual({ + clientX: 300, + clientY: 300, + }); + expect(viewport.toLocalPoint({ clientX: 300, clientY: 300 })).toEqual({ + clientX: 100, + clientY: 100, + }); }); }); diff --git a/packages/designer/tests/designer/builtin-hotkey.test.ts b/packages/designer/tests/designer/builtin-hotkey.test.ts index 9cb068ac19..0e34a06332 100644 --- a/packages/designer/tests/designer/builtin-hotkey.test.ts +++ b/packages/designer/tests/designer/builtin-hotkey.test.ts @@ -1,18 +1,14 @@ import '../fixtures/window'; -import { - Editor, - globalContext, - Hotkey as InnerHotkey, -} from '@alilc/lowcode-editor-core'; +import { Editor, globalContext, Hotkey as InnerHotkey } from '@felce/lowcode-editor-core'; import { Designer } from '../../src/designer/designer'; import formSchema from '../fixtures/schema/form'; import { fireEvent } from '@testing-library/react'; import { builtinHotkey } from '../../../engine/src/inner-plugins/builtin-hotkey'; import { shellModelFactory } from '../../../engine/src/modules/shell-model-factory'; -import { ILowCodePluginContextPrivate, LowCodePluginManager } from '@alilc/lowcode-designer'; -import { IPublicApiPlugins } from '@alilc/lowcode-types'; -import { Logger, Project, Canvas } from '@alilc/lowcode-shell'; -import { Workspace } from '@alilc/lowcode-workspace'; +import { ILowCodePluginContextPrivate, LowCodePluginManager } from '@felce/lowcode-designer'; +import { IPublicApiPlugins } from '@felce/lowcode-types'; +import { Logger, Project, Canvas } from '@felce/lowcode-shell'; +import { Workspace } from '@felce/lowcode-workspace'; const editor = new Editor(); const workspace = new Workspace(); @@ -29,13 +25,13 @@ describe('快捷键测试', () => { const hotkey: any = new InnerHotkey(); const logger = new Logger({ level: 'warn', bizName: 'common' }); const contextApiAssembler = { - assembleApis(context: ILowCodePluginContextPrivate){ + assembleApis(context: ILowCodePluginContextPrivate) { context.plugins = pluginManager as IPublicApiPlugins; context.hotkey = hotkey; context.logger = logger; context.project = project; context.canvas = new Canvas(editor); - } + }, }; pluginManager = new LowCodePluginManager(contextApiAssembler).toProxy(); pluginManager.register(builtinHotkey); @@ -45,7 +41,7 @@ describe('快捷键测试', () => { pluginManager.init().then(() => { resolve({}); }); - }) + }); }); afterAll(() => { pluginManager.dispose(); @@ -138,12 +134,12 @@ describe('快捷键测试', () => { let secondButtonNode = designer.currentDocument?.getNode('node_k1ow3cbp')!; // 等待第一个 session 结束 - await new Promise(resolve => setTimeout(resolve, 1000)); + await new Promise((resolve) => setTimeout(resolve, 1000)); firstButtonNode.remove(); expect(secondButtonNode.getParent()?.children.size).toBe(1); - await new Promise(resolve => setTimeout(resolve, 1000)); + await new Promise((resolve) => setTimeout(resolve, 1000)); fireEvent.keyDown(document, { keyCode: 90, metaKey: true }); @@ -158,12 +154,12 @@ describe('快捷键测试', () => { let secondButtonNode = designer.currentDocument?.getNode('node_k1ow3cbp')!; // 等待第一个 session 结束 - await new Promise(resolve => setTimeout(resolve, 1000)); + await new Promise((resolve) => setTimeout(resolve, 1000)); firstButtonNode.remove(); expect(secondButtonNode.getParent()?.children.size).toBe(1); - await new Promise(resolve => setTimeout(resolve, 1000)); + await new Promise((resolve) => setTimeout(resolve, 1000)); fireEvent.keyDown(document, { keyCode: 90, metaKey: true }); @@ -171,7 +167,7 @@ describe('快捷键测试', () => { secondButtonNode = designer.currentDocument?.getNode('node_k1ow3cbp')!; expect(secondButtonNode.getParent()?.children.size).toBe(2); - await new Promise(resolve => setTimeout(resolve, 1000)); + await new Promise((resolve) => setTimeout(resolve, 1000)); fireEvent.keyDown(document, { keyCode: 89, metaKey: true }); @@ -195,7 +191,7 @@ describe('快捷键测试', () => { fireEvent.keyDown(document, { keyCode: 86, metaKey: true }); - await new Promise(resolve => setTimeout(resolve, 1000)); + await new Promise((resolve) => setTimeout(resolve, 1000)); // clipboard 异步,先注释 // expect(secondButtonNode.getParent()?.children.size).toBe(3); @@ -226,7 +222,6 @@ describe('快捷键测试', () => { expect(secondButtonNode.prevSibling).toBeNull(); }); - describe('非正常分支', () => { it('liveEditing mode', () => { designer.project.mountSimulator({ @@ -392,4 +387,4 @@ describe('快捷键测试', () => { fireEvent.keyDown(document, { keyCode: 46 }); }); }); -}); \ No newline at end of file +}); diff --git a/packages/designer/tests/designer/designer.test.ts b/packages/designer/tests/designer/designer.test.ts index 8bca7d84a1..3b1138a8d5 100644 --- a/packages/designer/tests/designer/designer.test.ts +++ b/packages/designer/tests/designer/designer.test.ts @@ -1,5 +1,5 @@ import '../fixtures/window'; -import { Editor, globalContext, Setters } from '@alilc/lowcode-editor-core'; +import { Editor, globalContext, Setters } from '@felce/lowcode-editor-core'; import { Project } from '../../src/project/project'; import { DocumentModel } from '../../src/document/document-model'; import { Designer } from '../../src/designer/designer'; @@ -11,7 +11,7 @@ import pageMetadata from '../fixtures/component-metadata/page'; import divMetadata from '../fixtures/component-metadata/div'; import { delayObxTick } from '../utils'; import { fireEvent } from '@testing-library/react'; -import { IPublicEnumDragObjectType, IPublicEnumTransformStage } from '@alilc/lowcode-types'; +import { IPublicEnumDragObjectType, IPublicEnumTransformStage } from '@felce/lowcode-types'; import { shellModelFactory } from '../../../engine/src/modules/shell-model-factory'; const mockNode = { @@ -142,9 +142,11 @@ describe('Designer 测试', () => { dragon.boost( { type: IPublicEnumDragObjectType.NodeData, - data: [{ - componentName: 'Button', - }], + data: [ + { + componentName: 'Button', + }, + ], }, new MouseEvent('mousedown', { clientX: 100, clientY: 100 }), ); @@ -192,9 +194,13 @@ describe('Designer 测试', () => { it('addPropsReducer / transformProps', () => { // 没有相应的 reducer - expect(designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Init)).toEqual({ num: 1 }); + expect(designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Init)).toEqual({ + num: 1, + }); // props 是数组 - expect(designer.transformProps([{ num: 1 }], mockNode, IPublicEnumTransformStage.Init)).toEqual([{ num: 1 }]); + expect(designer.transformProps([{ num: 1 }], mockNode, IPublicEnumTransformStage.Init)).toEqual( + [{ num: 1 }], + ); designer.addPropsReducer((props, node) => { props.num += 1; @@ -231,17 +237,31 @@ describe('Designer 测试', () => { return props; }, IPublicEnumTransformStage.Upgrade); - expect(designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Init)).toEqual({ num: 3 }); - expect(designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Clone)).toEqual({ num: 2 }); - expect(designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Serilize)).toEqual({ num: 2 }); - expect(designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Render)).toEqual({ num: 2 }); - expect(designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Save)).toEqual({ num: 2 }); - expect(designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Upgrade)).toEqual({ num: 2 }); + expect(designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Init)).toEqual({ + num: 3, + }); + expect(designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Clone)).toEqual({ + num: 2, + }); + expect( + designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Serilize), + ).toEqual({ num: 2 }); + expect(designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Render)).toEqual( + { num: 2 }, + ); + expect(designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Save)).toEqual({ + num: 2, + }); + expect( + designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Upgrade), + ).toEqual({ num: 2 }); designer.addPropsReducer((props, node) => { throw new Error('calculate error'); }, IPublicEnumTransformStage.Upgrade); - expect(designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Upgrade)).toEqual({ num: 2 }); + expect( + designer.transformProps({ num: 1 }, mockNode, IPublicEnumTransformStage.Upgrade), + ).toEqual({ num: 2 }); }); it('setProps', () => { @@ -256,14 +276,18 @@ describe('Designer 测试', () => { editor, shellModelFactory, ...initialProps, - }); + }); expect(designer.simulatorComponent).toEqual({ isSimulatorComp: true }); expect(designer.simulatorProps).toEqual({ designMode: 'design' }); expect(designer.suspensed).toBeTruthy(); expect((designer as any)._componentMetasMap.has('Div')).toBeTruthy(); expect((designer as any)._componentMetasMap.has('Button')).toBeTruthy(); - const { editor: editorFromDesigner, shellModelFactory: shellModelFactoryFromDesigner, ...others } = (designer as any).props; + const { + editor: editorFromDesigner, + shellModelFactory: shellModelFactoryFromDesigner, + ...others + } = (designer as any).props; expect(others).toEqual(initialProps); expect(designer.get('simulatorProps')).toEqual({ designMode: 'design' }); expect(designer.get('suspensed')).toBeTruthy(); @@ -283,7 +307,11 @@ describe('Designer 测试', () => { expect(designer.suspensed).toBeFalsy(); expect((designer as any)._componentMetasMap.has('Button')).toBeTruthy(); expect((designer as any)._componentMetasMap.has('Div')).toBeTruthy(); - const { editor: editorFromDesigner2, shellModelFactory: shellModelFactoryFromDesigner2, ...others2 } = (designer as any).props; + const { + editor: editorFromDesigner2, + shellModelFactory: shellModelFactoryFromDesigner2, + ...others2 + } = (designer as any).props; expect(others2).toEqual(updatedProps); // 第三次设置 props,跟第二次值一样,for 覆盖率测试 @@ -295,7 +323,11 @@ describe('Designer 测试', () => { expect(designer.suspensed).toBeFalsy(); expect((designer as any)._componentMetasMap.has('Button')).toBeTruthy(); expect((designer as any)._componentMetasMap.has('Div')).toBeTruthy(); - const { editor: editorFromDesigner3, shellModelFactory: shellModelFactoryFromDesigner3, ...others3 } = (designer as any).props; + const { + editor: editorFromDesigner3, + shellModelFactory: shellModelFactoryFromDesigner3, + ...others3 + } = (designer as any).props; expect(others3).toEqual(updatedProps); }); @@ -373,13 +405,16 @@ describe('Designer 测试', () => { setupComponents: fn, }); await designer.loadIncrementalAssets({ - components: [{ - componentName: 'Div2', - title: '容器', - docUrl: 'http://gitlab.alibaba-inc.com/vision-components/vc-block/blob/master/README.md', - devMode: 'proCode', - tags: ['布局'], - }], + components: [ + { + componentName: 'Div2', + title: '容器', + docUrl: + 'http://gitlab.alibaba-inc.com/vision-components/vc-block/blob/master/README.md', + devMode: 'proCode', + tags: ['布局'], + }, + ], packages: [], }); diff --git a/packages/designer/tests/designer/dragon.test.ts b/packages/designer/tests/designer/dragon.test.ts index 1041f0425d..a7bd35655b 100644 --- a/packages/designer/tests/designer/dragon.test.ts +++ b/packages/designer/tests/designer/dragon.test.ts @@ -1,5 +1,5 @@ import '../fixtures/window'; -import { Editor, globalContext } from '@alilc/lowcode-editor-core'; +import { Editor, globalContext } from '@felce/lowcode-editor-core'; import { Project } from '../../src/project/project'; import { DocumentModel } from '../../src/document/document-model'; import { Designer } from '../../src/designer/designer'; @@ -14,7 +14,7 @@ import { isInvalidPoint, isSameAs, } from '../../src/designer/dragon'; -import { IPublicEnumDragObjectType } from '@alilc/lowcode-types'; +import { IPublicEnumDragObjectType } from '@felce/lowcode-types'; import formSchema from '../fixtures/schema/form'; import { fireEvent } from '@testing-library/react'; import { shellModelFactory } from '../../../engine/src/modules/shell-model-factory'; @@ -327,7 +327,9 @@ describe('导出的其他函数', () => { expect(isDragNodeObject({ type: IPublicEnumDragObjectType.Node, nodes: [] })).toBeTruthy(); }); it('isDragNodeDataObject', () => { - expect(isDragNodeDataObject({ type: IPublicEnumDragObjectType.NodeData, data: [] })).toBeTruthy(); + expect( + isDragNodeDataObject({ type: IPublicEnumDragObjectType.NodeData, data: [] }), + ).toBeTruthy(); }); it('isDragAnyObject', () => { expect(isDragAnyObject()).toBeFalsy(); diff --git a/packages/designer/tests/designer/scroller.test.ts b/packages/designer/tests/designer/scroller.test.ts index ff03608b04..16ec7fcf1d 100644 --- a/packages/designer/tests/designer/scroller.test.ts +++ b/packages/designer/tests/designer/scroller.test.ts @@ -1,12 +1,10 @@ import '../fixtures/window'; -import { Editor, globalContext } from '@alilc/lowcode-editor-core'; +import { Editor, globalContext } from '@felce/lowcode-editor-core'; import { Project } from '../../src/project/project'; import { DocumentModel } from '../../src/document/document-model'; import { ScrollTarget, Scroller } from '../../src/designer/scroller'; import { Designer } from '../../src/designer/designer'; -import { - Dragon, -} from '../../src/designer/dragon'; +import { Dragon } from '../../src/designer/dragon'; import formSchema from '../fixtures/schema/form'; import { shellModelFactory } from '../../../engine/src/modules/shell-model-factory'; @@ -51,8 +49,12 @@ describe('Scroller 测试', () => { scrollY = x.top; } }, - get scrollX() { return scrollX; }, - get scrollY() { return scrollY; }, + get scrollX() { + return scrollX; + }, + get scrollY() { + return scrollY; + }, scrollHeight: 1000, scrollWidth: 500, document: {}, @@ -91,7 +93,10 @@ describe('Scroller 测试', () => { it('scrollTarget: ScrollTarget', () => { const win = getMockWindow(); const scrollTarget = new ScrollTarget(win); - const scroller = new Scroller({ scrollTarget, bounds: { width: 50, height: 50, top: 50, bottom: 50, left: 50, right: 50 } }); + const scroller = new Scroller({ + scrollTarget, + bounds: { width: 50, height: 50, top: 50, bottom: 50, left: 50, right: 50 }, + }); mockRAF(); scroller.scrollTo({ left: 50, top: 50 }); @@ -102,7 +107,10 @@ describe('Scroller 测试', () => { it('scrollTarget: ScrollTarget, same left / top', () => { const win = getMockWindow(); const scrollTarget = new ScrollTarget(win); - const scroller = new Scroller({ scrollTarget, bounds: { width: 50, height: 50, top: 50, bottom: 50, left: 50, right: 50 } }); + const scroller = new Scroller({ + scrollTarget, + bounds: { width: 50, height: 50, top: 50, bottom: 50, left: 50, right: 50 }, + }); mockRAF(); scrollTarget.scrollTo({ left: 50, top: 50 }); scroller.scrollTo({ left: 50, top: 50 }); @@ -114,7 +122,10 @@ describe('Scroller 测试', () => { it('scrollTarget: Element', () => { const win = getMockWindow(); // const scrollTarget = new ScrollTarget(win); - const scroller = new Scroller({ scrollTarget: win, bounds: { width: 50, height: 50, top: 50, bottom: 50, left: 50, right: 50 } }); + const scroller = new Scroller({ + scrollTarget: win, + bounds: { width: 50, height: 50, top: 50, bottom: 50, left: 50, right: 50 }, + }); mockRAF(); scroller.scrollTo({ left: 50, top: 50 }); @@ -125,7 +136,10 @@ describe('Scroller 测试', () => { it('scrollTarget: null', () => { const win = getMockWindow(); // const scrollTarget = new ScrollTarget(win); - const scroller = new Scroller({ scrollTarget: null, bounds: { width: 50, height: 50, top: 50, bottom: 50, left: 50, right: 50 } }); + const scroller = new Scroller({ + scrollTarget: null, + bounds: { width: 50, height: 50, top: 50, bottom: 50, left: 50, right: 50 }, + }); mockRAF(); scroller.scrollTo({ left: 50, top: 50 }); diff --git a/packages/designer/tests/designer/setting/setting-field.test.ts b/packages/designer/tests/designer/setting/setting-field.test.ts index 53ed2829df..8b663f1b02 100644 --- a/packages/designer/tests/designer/setting/setting-field.test.ts +++ b/packages/designer/tests/designer/setting/setting-field.test.ts @@ -1,12 +1,7 @@ // @ts-nocheck import '../../fixtures/window'; -import { - Editor, - Setters as InnerSetters, -} from '@alilc/lowcode-editor-core'; -import { - Setters, -} from '@alilc/lowcode-shell'; +import { Editor, Setters as InnerSetters } from '@felce/lowcode-editor-core'; +import { Setters } from '@felce/lowcode-shell'; import { SettingTopEntry } from '../../../src/designer/setting/setting-top-entry'; import { SettingField } from '../../../src/designer/setting/setting-field'; import { Node } from '../../../src/document/node/node'; @@ -79,7 +74,7 @@ describe('setting-field 测试', () => { }); expect(field.items).toHaveLength(0); expect(field.getItems()).toHaveLength(0); - expect(field.getItems(x => x)).toHaveLength(0); + expect(field.getItems((x) => x)).toHaveLength(0); expect(field.setter.componentName).toBe('MixedSetter'); field.purge(); @@ -110,7 +105,7 @@ describe('setting-field 测试', () => { const objField = settingEntry.get('obj'); expect(objField.items).toHaveLength(3); expect(objField.getItems()).toHaveLength(3); - expect(objField.getItems(x => x.name === 'a')).toHaveLength(1); + expect(objField.getItems((x) => x.name === 'a')).toHaveLength(1); objField.purge(); expect(objField.items).toHaveLength(0); const objAField = settingEntry.get('obj.a'); @@ -155,17 +150,17 @@ describe('setting-field 测试', () => { name: '2', title: 'sub', }); - subArrField.setValue({name: '1'}); + subArrField.setValue({ name: '1' }); expect(subArrField.path).toEqual(['arr', 0]); expect(subArrField02.path).toEqual(['arr', 1]); - subArrField02.setValue({name: '2'}); - expect(subArrField.getValue()).toEqual({name: '1'}); - expect(arrField.getHotValue()).toEqual([{name: '1'}, {name: '2'}]); + subArrField02.setValue({ name: '2' }); + expect(subArrField.getValue()).toEqual({ name: '1' }); + expect(arrField.getHotValue()).toEqual([{ name: '1' }, { name: '2' }]); subArrField.clearValue(); expect(subArrField.getValue()).toBeUndefined(); - expect(arrField.getHotValue()).toEqual([undefined, {name: '2'}]); - subArrField03.setValue({name: '3'}); - expect(arrField.getHotValue()).toEqual([undefined, {name: '2'}, {name: '3'}]); + expect(arrField.getHotValue()).toEqual([undefined, { name: '2' }]); + subArrField03.setValue({ name: '3' }); + expect(arrField.getHotValue()).toEqual([undefined, { name: '2' }, { name: '3' }]); }); it('js expression setValue / setHotValue', () => { @@ -232,10 +227,10 @@ describe('setting-field 测试', () => { const mockFnSubArrField = jest.fn(); const mockFnObjSubField = jest.fn(); - arrField.setValue([{ objSub: "subMock0.Index.0" }]); + arrField.setValue([{ objSub: 'subMock0.Index.0' }]); // 这里需要 setValue 两遍,触发 prop 的 purge 方法,使 purged 为 true,之后的 purge 方法不会正常执行,prop 才能正常缓存,autorun 才能正常执行 // TODO: 该机制后续得研究一下,再确定是否要修改 - arrField.setValue([{ objSub: "subMock0.Index.0" }]); + arrField.setValue([{ objSub: 'subMock0.Index.0' }]); arrField.onEffect(() => { mockFnArrField(arrField.getValue()); @@ -250,32 +245,32 @@ describe('setting-field 测试', () => { await delayObxTick(); expect(mockFnObjSubField).toHaveBeenCalledWith('subMock0.Index.0'); - expect(mockFnSubArrField).toHaveBeenCalledWith({ objSub: "subMock0.Index.0" }); - expect(mockFnArrField).toHaveBeenCalledWith([{ objSub: "subMock0.Index.0" }]); + expect(mockFnSubArrField).toHaveBeenCalledWith({ objSub: 'subMock0.Index.0' }); + expect(mockFnArrField).toHaveBeenCalledWith([{ objSub: 'subMock0.Index.0' }]); - arrField.setValue([{ objSub: "subMock0.Index.1" }]); + arrField.setValue([{ objSub: 'subMock0.Index.1' }]); await delayObxTick(); expect(mockFnObjSubField).toHaveBeenCalledWith('subMock0.Index.1'); - expect(mockFnSubArrField).toHaveBeenCalledWith({ objSub: "subMock0.Index.1" }); - expect(mockFnArrField).toHaveBeenCalledWith([{ objSub: "subMock0.Index.1" }]); + expect(mockFnSubArrField).toHaveBeenCalledWith({ objSub: 'subMock0.Index.1' }); + expect(mockFnArrField).toHaveBeenCalledWith([{ objSub: 'subMock0.Index.1' }]); - subArrField.setValue({ objSub: "subMock0.Index.2" }); + subArrField.setValue({ objSub: 'subMock0.Index.2' }); await delayObxTick(); expect(mockFnObjSubField).toHaveBeenCalledWith('subMock0.Index.2'); - expect(mockFnSubArrField).toHaveBeenCalledWith({ objSub: "subMock0.Index.2" }); - expect(mockFnArrField).toHaveBeenCalledWith([{ objSub: "subMock0.Index.2" }]); + expect(mockFnSubArrField).toHaveBeenCalledWith({ objSub: 'subMock0.Index.2' }); + expect(mockFnArrField).toHaveBeenCalledWith([{ objSub: 'subMock0.Index.2' }]); objSubField.setValue('subMock0.Index.3'); await delayObxTick(); expect(mockFnObjSubField).toHaveBeenCalledWith('subMock0.Index.3'); - expect(mockFnSubArrField).toHaveBeenCalledWith({ objSub: "subMock0.Index.3" }); - expect(mockFnArrField).toHaveBeenCalledWith([{ objSub: "subMock0.Index.3" }]); - }) + expect(mockFnSubArrField).toHaveBeenCalledWith({ objSub: 'subMock0.Index.3' }); + expect(mockFnArrField).toHaveBeenCalledWith([{ objSub: 'subMock0.Index.3' }]); + }); }); }); diff --git a/packages/designer/tests/designer/setting/setting-prop-entry.test.ts b/packages/designer/tests/designer/setting/setting-prop-entry.test.ts index 3ece67af76..776c65a48b 100644 --- a/packages/designer/tests/designer/setting/setting-prop-entry.test.ts +++ b/packages/designer/tests/designer/setting/setting-prop-entry.test.ts @@ -1,8 +1,5 @@ import '../../fixtures/window'; -import { - Editor, - Setters as InnerSetters, -} from '@alilc/lowcode-editor-core'; +import { Editor, Setters as InnerSetters } from '@felce/lowcode-editor-core'; import { SettingTopEntry } from '../../../src/designer/setting/setting-top-entry'; import { SettingPropEntry } from '../../../src/designer/setting/setting-prop-entry'; import { Node } from '../../../src/document/node/node'; @@ -48,7 +45,7 @@ describe('setting-prop-entry 测试', () => { type: 'JSExpression', value: 'state.a', mock: 111, - } + }, }, }); mockTopEntry = new SettingTopEntry(editor, [mockNode]); @@ -77,7 +74,9 @@ describe('setting-prop-entry 测试', () => { prop1.extraProps = { getValue: (prop, val) => `prefix ${val}`, // prop 是 shell prop entry - setValue: (prop, val) => { prop.setValue(`modified ${val}`, { disableMutator: true }) }, + setValue: (prop, val) => { + prop.setValue(`modified ${val}`, { disableMutator: true }); + }, defaultValue: 'default', }; @@ -107,7 +106,9 @@ describe('setting-prop-entry 测试', () => { const prop4 = mockTopEntry.getProp('b'); prop4.extraProps = { - getValue: () => { throw 'error'; }, + getValue: () => { + throw 'error'; + }, }; expect(prop4.getValue()).toBe(222); }); diff --git a/packages/designer/tests/designer/setting/setting-top-entry.test.ts b/packages/designer/tests/designer/setting/setting-top-entry.test.ts index 23a42c2afc..94510d2cb4 100644 --- a/packages/designer/tests/designer/setting/setting-top-entry.test.ts +++ b/packages/designer/tests/designer/setting/setting-top-entry.test.ts @@ -1,5 +1,5 @@ import '../../fixtures/window'; -import { Editor, Setters } from '@alilc/lowcode-editor-core'; +import { Editor, Setters } from '@felce/lowcode-editor-core'; import { Node } from '../../../src/document/node/node'; import { Designer } from '../../../src/designer/designer'; import settingSchema from '../../fixtures/schema/setting'; @@ -11,7 +11,7 @@ const editor = new Editor(); describe('setting-top-entry 测试', () => { let designer: Designer; beforeEach(() => { - editor.set('setters', new Setters()) + editor.set('setters', new Setters()); designer = new Designer({ editor, shellModelFactory }); }); afterEach(() => { @@ -93,7 +93,7 @@ describe('setting-top-entry 测试', () => { const { settingEntry } = divNode; // 模拟将第一个配置变成 react funcional component - settingEntry.componentMeta.getMetadata().combined[0].items[0] = props => props.xx; + settingEntry.componentMeta.getMetadata().combined[0].items[0] = (props) => props.xx; settingEntry.setupItems(); }); diff --git a/packages/designer/tests/document/document-model/document-model.test.ts b/packages/designer/tests/document/document-model/document-model.test.ts index b47200cbaf..89512472fd 100644 --- a/packages/designer/tests/document/document-model/document-model.test.ts +++ b/packages/designer/tests/document/document-model/document-model.test.ts @@ -1,6 +1,6 @@ import '../../fixtures/window'; import { DocumentModel, isDocumentModel, isPageSchema } from '../../../src/document/document-model'; -import { Editor } from '@alilc/lowcode-editor-core'; +import { Editor } from '@felce/lowcode-editor-core'; import { Project } from '../../../src/project/project'; import { Designer } from '../../../src/designer/designer'; import formSchema from '../../fixtures/schema/form'; @@ -239,26 +239,18 @@ describe('document-model 测试', () => { data: { componentName: 'Form' }, }), ).toBeTruthy(); - expect( - doc.checkNesting(doc.getNode('page'), doc.getNode('form')) - ).toBeTruthy(); - expect( - doc.checkNesting(doc.getNode('page'), null) - ).toBeTruthy(); + expect(doc.checkNesting(doc.getNode('page'), doc.getNode('form'))).toBeTruthy(); + expect(doc.checkNesting(doc.getNode('page'), null)).toBeTruthy(); expect( doc.checkNesting(doc.getNode('page'), { type: 'nodedata', data: { componentName: 'Other' }, - }) + }), ).toBeFalsy(); - expect( - doc.checkNestingUp(doc.getNode('page'), { componentName: 'Other' }) - ).toBeFalsy(); + expect(doc.checkNestingUp(doc.getNode('page'), { componentName: 'Other' })).toBeFalsy(); - expect( - doc.checkNestingDown(doc.getNode('page'), { componentName: 'Other' }) - ).toBeTruthy(); + expect(doc.checkNestingDown(doc.getNode('page'), { componentName: 'Other' })).toBeTruthy(); expect(doc.checkNestingUp(doc.getNode('page'), null)).toBeTruthy(); }); @@ -268,15 +260,18 @@ describe('document-model 测试', () => { designer.createComponentMeta(otherMeta); const doc = new DocumentModel(project, formSchema); const comps = doc.getComponentsMap(['Other']); - expect(comps.find(comp => comp.componentName === 'Div')).toEqual( - { componentName: 'Div', package: '@ali/vc-div' } - ); - expect(comps.find(comp => comp.componentName === 'Other')).toEqual( - { componentName: 'Other', package: '@ali/vc-other' } - ); - expect(comps.find(comp => comp.componentName === 'Page')).toEqual( - { componentName: 'Page', devMode: 'lowCode' } - ); + expect(comps.find((comp) => comp.componentName === 'Div')).toEqual({ + componentName: 'Div', + package: '@ali/vc-div', + }); + expect(comps.find((comp) => comp.componentName === 'Other')).toEqual({ + componentName: 'Other', + package: '@ali/vc-other', + }); + expect(comps.find((comp) => comp.componentName === 'Page')).toEqual({ + componentName: 'Page', + devMode: 'lowCode', + }); const comps2 = doc.getComponentsMap(['Div']); }); diff --git a/packages/designer/tests/document/history/history.test.ts b/packages/designer/tests/document/history/history.test.ts index 63af8ecbf3..af02074601 100644 --- a/packages/designer/tests/document/history/history.test.ts +++ b/packages/designer/tests/document/history/history.test.ts @@ -1,8 +1,8 @@ import '../../fixtures/window'; -import { mobx, makeAutoObservable, globalContext, Editor } from '@alilc/lowcode-editor-core'; +import { mobx, makeAutoObservable, globalContext, Editor } from '@felce/lowcode-editor-core'; import { History } from '../../../src/document/history'; import { delay } from '../../utils/misc'; -import { Workspace } from '@alilc/lowcode-workspace'; +import { Workspace } from '@felce/lowcode-workspace'; class Node { data: number; @@ -161,64 +161,43 @@ describe('History', () => { // step 1 history.back(); - expect(mockCursorFn).toHaveBeenNthCalledWith( - 1, - JSON.stringify(dataCursor2), - ); + expect(mockCursorFn).toHaveBeenNthCalledWith(1, JSON.stringify(dataCursor2)); expect(mockStateFn).toHaveBeenNthCalledWith(1, 7); expect(mockRedoFn).toHaveBeenNthCalledWith(1, dataCursor2); // step 2 history.back(); - expect(mockCursorFn).toHaveBeenNthCalledWith( - 2, - JSON.stringify(dataCursor1), - ); + expect(mockCursorFn).toHaveBeenNthCalledWith(2, JSON.stringify(dataCursor1)); expect(mockStateFn).toHaveBeenNthCalledWith(2, 7); expect(mockRedoFn).toHaveBeenNthCalledWith(2, dataCursor1); // step 3 history.back(); - expect(mockCursorFn).toHaveBeenNthCalledWith( - 3, - JSON.stringify(dataCursor0), - ); + expect(mockCursorFn).toHaveBeenNthCalledWith(3, JSON.stringify(dataCursor0)); expect(mockStateFn).toHaveBeenNthCalledWith(3, 7 - 4 - 1); expect(mockRedoFn).toHaveBeenNthCalledWith(3, dataCursor0); // step 4 history.forward(); - expect(mockCursorFn).toHaveBeenNthCalledWith( - 4, - JSON.stringify(dataCursor1), - ); + expect(mockCursorFn).toHaveBeenNthCalledWith(4, JSON.stringify(dataCursor1)); expect(mockStateFn).toHaveBeenNthCalledWith(4, 7); expect(mockRedoFn).toHaveBeenNthCalledWith(4, dataCursor1); // step 5 history.forward(); - expect(mockCursorFn).toHaveBeenNthCalledWith( - 5, - JSON.stringify(dataCursor2), - ); + expect(mockCursorFn).toHaveBeenNthCalledWith(5, JSON.stringify(dataCursor2)); expect(mockStateFn).toHaveBeenNthCalledWith(5, 7); expect(mockRedoFn).toHaveBeenNthCalledWith(5, dataCursor2); // step 6 history.go(3); - expect(mockCursorFn).toHaveBeenNthCalledWith( - 6, - JSON.stringify(dataCursor3), - ); + expect(mockCursorFn).toHaveBeenNthCalledWith(6, JSON.stringify(dataCursor3)); expect(mockStateFn).toHaveBeenNthCalledWith(6, 7 - 2); expect(mockRedoFn).toHaveBeenNthCalledWith(6, dataCursor3); // step 7 history.go(0); - expect(mockCursorFn).toHaveBeenNthCalledWith( - 7, - JSON.stringify(dataCursor0), - ); + expect(mockCursorFn).toHaveBeenNthCalledWith(7, JSON.stringify(dataCursor0)); expect(mockStateFn).toHaveBeenNthCalledWith(7, 7 - 4 - 1); expect(mockRedoFn).toHaveBeenNthCalledWith(7, dataCursor0); @@ -316,8 +295,7 @@ describe('History - errors', () => { const data = tree.toObject(); return data; }, - (data) => { - }, + (data) => {}, ); history.back(); @@ -330,8 +308,7 @@ describe('History - errors', () => { const data = tree.toObject(); return data; }, - (data) => { - }, + (data) => {}, ); // @ts-ignore @@ -340,4 +317,4 @@ describe('History - errors', () => { history.forward(); history.savePoint(); }); -}); \ No newline at end of file +}); diff --git a/packages/designer/tests/document/node/modal-nodes-manager.test.ts b/packages/designer/tests/document/node/modal-nodes-manager.test.ts index 3e5dcdb79e..34b9d3f8d3 100644 --- a/packages/designer/tests/document/node/modal-nodes-manager.test.ts +++ b/packages/designer/tests/document/node/modal-nodes-manager.test.ts @@ -1,5 +1,5 @@ import '../../fixtures/window'; -import { Editor } from '@alilc/lowcode-editor-core'; +import { Editor } from '@felce/lowcode-editor-core'; import { Project } from '../../../src/project/project'; import { DocumentModel } from '../../../src/document/document-model'; import { Node } from '../../../src/document/node/node'; @@ -109,4 +109,4 @@ describe('其他方法', () => { const node = doc.createNode({ componentName: 'Leaf', children: 'haha' }); expect(getModalNodes(node)).toEqual([]); }); -}); \ No newline at end of file +}); diff --git a/packages/designer/tests/document/node/node-children.test.ts b/packages/designer/tests/document/node/node-children.test.ts index 1aa7e3ccb3..09aeacc23f 100644 --- a/packages/designer/tests/document/node/node-children.test.ts +++ b/packages/designer/tests/document/node/node-children.test.ts @@ -1,10 +1,8 @@ import '../../fixtures/window'; -import { Editor } from '@alilc/lowcode-editor-core'; +import { Editor } from '@felce/lowcode-editor-core'; import { Project } from '../../../src/project/project'; import { DocumentModel } from '../../../src/document/document-model'; -import { - Node, -} from '../../../src/document/node/node'; +import { Node } from '../../../src/document/node/node'; import { Designer } from '../../../src/designer/designer'; import formSchema from '../../fixtures/schema/form'; import divMetadata from '../../fixtures/component-metadata/div'; diff --git a/packages/designer/tests/document/node/node.test.ts b/packages/designer/tests/document/node/node.test.ts index 2695d6c838..651c063beb 100644 --- a/packages/designer/tests/document/node/node.test.ts +++ b/packages/designer/tests/document/node/node.test.ts @@ -1,13 +1,9 @@ // @ts-nocheck import '../../fixtures/window'; import { set } from '../../utils'; -import { - Editor, - globalContext, - Setters as InnerSetters, -} from '@alilc/lowcode-editor-core'; +import { Editor, globalContext, Setters as InnerSetters } from '@felce/lowcode-editor-core'; import { Project } from '../../../src/project/project'; -import { Workspace as InnerWorkspace } from '@alilc/lowcode-workspace'; +import { Workspace as InnerWorkspace } from '@felce/lowcode-workspace'; import { DocumentModel } from '../../../src/document/document-model'; import { isRootNode, @@ -27,8 +23,8 @@ import rootHeaderMetadata from '../../fixtures/component-metadata/root-header'; import rootContentMetadata from '../../fixtures/component-metadata/root-content'; import rootFooterMetadata from '../../fixtures/component-metadata/root-footer'; import { shellModelFactory } from '../../../../engine/src/modules/shell-model-factory'; -import { isNode } from '@alilc/lowcode-utils'; -import { Setters } from '@alilc/lowcode-shell'; +import { isNode } from '@felce/lowcode-utils'; +import { Setters } from '@felce/lowcode-shell'; describe('Node 方法测试', () => { let editor: Editor; @@ -73,7 +69,10 @@ describe('Node 方法测试', () => { // Case 3: When children is array test('initialChildren returns result of initialChildren function when children is null ', () => { const node = new Node(doc, { componentName: 'Button', props: { a: 1 } }); - const childrenArray = [{ id: 1, name: 'Child 1' }, { id: 2, name: 'Child 2' }]; + const childrenArray = [ + { id: 1, name: 'Child 1' }, + { id: 2, name: 'Child 2' }, + ]; const result = node.initialChildren(childrenArray); // 预期结果是一个数组 expect(result).toEqual(childrenArray); @@ -106,8 +105,7 @@ describe('Node 方法测试', () => { expect(result).toEqual([false]); }); - - it('condition group', () => { }); + it('condition group', () => {}); it('getExtraProp / setExtraProp', () => { const firstBtn = doc.getNode('node_k1ow3cbn')!; @@ -420,7 +418,7 @@ describe('Node 方法测试', () => { expect(mockFn).not.toHaveBeenCalled(); }); - it('addSlot / unlinkSlot / removeSlot', () => { }); + it('addSlot / unlinkSlot / removeSlot', () => {}); it('setProps', () => { const firstBtn = doc.getNode('node_k1ow3cbn')!; @@ -536,8 +534,8 @@ describe('Node 方法测试', () => { designer.createComponentMeta(divMetadata); designer.createComponentMeta(formMetadata); const callbacks = form.componentMeta.advanced.callbacks; - const fn1 = callbacks.onNodeAdd = jest.fn(); - const fn2 = callbacks.onNodeRemove = jest.fn(); + const fn1 = (callbacks.onNodeAdd = jest.fn()); + const fn2 = (callbacks.onNodeRemove = jest.fn()); const textField = doc.getNode('node_k1ow3cc9'); form.didDropIn(textField); expect(fn1).toHaveBeenCalledWith(textField.internalToShellNode(), form.internalToShellNode()); @@ -599,7 +597,7 @@ describe('Node 方法测试', () => { expect(comparePosition(firstBtn, firstCard)).toBe(PositionNO.BeforeOrAfter); }); - it('getZLevelTop', () => { }); + it('getZLevelTop', () => {}); it('propsData', () => { expect(new Node(doc, { componentName: 'Leaf' }).propsData).toBeNull(); expect(new Node(doc, { componentName: 'Fragment' }).propsData).toBeNull(); diff --git a/packages/designer/tests/document/node/props/prop.test.ts b/packages/designer/tests/document/node/props/prop.test.ts index ff4147a34a..d7b5bb50b6 100644 --- a/packages/designer/tests/document/node/props/prop.test.ts +++ b/packages/designer/tests/document/node/props/prop.test.ts @@ -1,9 +1,9 @@ import '../../../fixtures/window'; -import { Editor, engineConfig } from '@alilc/lowcode-editor-core'; +import { Editor, engineConfig } from '@felce/lowcode-editor-core'; import { Designer } from '../../../../src/designer/designer'; import { DocumentModel } from '../../../../src/document/document-model'; import { Prop, isProp, isValidArrayIndex } from '../../../../src/document/node/props/prop'; -import { GlobalEvent, IPublicEnumTransformStage } from '@alilc/lowcode-types'; +import { GlobalEvent, IPublicEnumTransformStage } from '@felce/lowcode-types'; import { shellModelFactory } from '../../../../../engine/src/modules/shell-model-factory'; const slotNodeImportMockFn = jest.fn(); @@ -416,7 +416,7 @@ describe('Prop 类测试', () => { expect(prop.get(0).getValue()).toBeTruthy(); // map / list 级联测试 - prop.get('loopArgs.0', true).setValue('newItem');; + prop.get('loopArgs.0', true).setValue('newItem'); expect(prop.get('loopArgs.0').getValue()).toBe('newItem'); }); @@ -502,7 +502,9 @@ describe('Prop 类测试', () => { slotProp.export(); expect(slotProp.export().value[0].componentName).toBe('Button'); - expect(slotProp.export(IPublicEnumTransformStage.Serilize).value[0].componentName).toBe('Button'); + expect(slotProp.export(IPublicEnumTransformStage.Serilize).value[0].componentName).toBe( + 'Button', + ); slotProp.purge(); expect(slotProp.purged).toBeTruthy(); @@ -529,14 +531,14 @@ describe('Prop 类测试', () => { componentName: 'Slot', id: 'node_oclei5rv2e2', props: { - slotName: "content", - slotTitle: "主内容" + slotName: 'content', + slotTitle: '主内容', }, children: [ { componentName: 'Button', - } - ] + }, + ], }, }); @@ -554,7 +556,9 @@ describe('Prop 类测试', () => { expect(slotProp.export()?.name).toBe('content'); // Render - expect(slotProp.export(IPublicEnumTransformStage.Render)?.value.children[0].componentName).toBe('Button'); + expect(slotProp.export(IPublicEnumTransformStage.Render)?.value.children[0].componentName).toBe( + 'Button', + ); expect(slotProp.export(IPublicEnumTransformStage.Render)?.value.componentName).toBe('Slot'); slotProp.purge(); @@ -583,7 +587,7 @@ describe('setValue with event', () => { beforeEach(() => { // Initialize the instance of your class - propInstance = new Prop(mockPropsInst, true, 'stringProp');; + propInstance = new Prop(mockPropsInst, true, 'stringProp'); // Mock necessary methods and properties mockEmitChange = jest.spyOn(propInstance, 'emitChange'); @@ -623,7 +627,10 @@ describe('setValue with event', () => { expect(propInstance.getValue()).toBe(newValue); expect(propInstance.type).toBe('literal'); expect(mockEmitChange).toHaveBeenCalledWith({ oldValue }); - expect(mockEventBusEmit).toHaveBeenCalledWith(GlobalEvent.Node.Prop.InnerChange, expectedPartialPropsInfo); + expect(mockEventBusEmit).toHaveBeenCalledWith( + GlobalEvent.Node.Prop.InnerChange, + expectedPartialPropsInfo, + ); expect(mockEmitPropChange).toHaveBeenCalledWith(expectedPartialPropsInfo); }); @@ -642,7 +649,10 @@ describe('setValue with event', () => { expect(propInstance.getValue()).toEqual(newValue); expect(propInstance.type).toBe('literal'); expect(mockEmitChange).toHaveBeenCalledWith({ oldValue }); - expect(mockEventBusEmit).toHaveBeenCalledWith(GlobalEvent.Node.Prop.InnerChange, expectedPartialPropsInfo); + expect(mockEventBusEmit).toHaveBeenCalledWith( + GlobalEvent.Node.Prop.InnerChange, + expectedPartialPropsInfo, + ); expect(mockEmitPropChange).toHaveBeenCalledWith(expectedPartialPropsInfo); }); @@ -663,7 +673,10 @@ describe('setValue with event', () => { oldValue, newValue: undefined, }); - expect(mockEventBusEmit).toHaveBeenCalledWith(GlobalEvent.Node.Prop.InnerChange, expectedPartialPropsInfo); + expect(mockEventBusEmit).toHaveBeenCalledWith( + GlobalEvent.Node.Prop.InnerChange, + expectedPartialPropsInfo, + ); expect(mockEmitPropChange).toHaveBeenCalledWith(expectedPartialPropsInfo); propInstance.unset(); @@ -688,7 +701,10 @@ describe('setValue with event', () => { oldValue, newValue: undefined, }); - expect(mockEventBusEmit).toHaveBeenCalledWith(GlobalEvent.Node.Prop.InnerChange, expectedPartialPropsInfo); + expect(mockEventBusEmit).toHaveBeenCalledWith( + GlobalEvent.Node.Prop.InnerChange, + expectedPartialPropsInfo, + ); expect(mockEmitPropChange).toHaveBeenCalledWith(expectedPartialPropsInfo); propInstance.remove(); diff --git a/packages/designer/tests/document/node/props/props.test.ts b/packages/designer/tests/document/node/props/props.test.ts index 0b15a00c0e..a95237aef4 100644 --- a/packages/designer/tests/document/node/props/props.test.ts +++ b/packages/designer/tests/document/node/props/props.test.ts @@ -1,7 +1,7 @@ // @ts-nocheck import '../../../fixtures/window'; import { set, delayObxTick } from '../../../utils'; -import { Editor } from '@alilc/lowcode-editor-core'; +import { Editor } from '@felce/lowcode-editor-core'; import { Props, getConvertedExtraKey, @@ -14,7 +14,7 @@ import { Designer } from '../../../../src/designer/designer'; import { Project } from '../../../../src/project/project'; import { DocumentModel } from '../../../../src/document/document-model'; -import { TransformStage } from '@alilc/lowcode-types'; +import { TransformStage } from '@felce/lowcode-types'; const mockOwner = { componentName: 'Page' }; diff --git a/packages/designer/tests/fixtures/component-metadata/abcgroup.ts b/packages/designer/tests/fixtures/component-metadata/abcgroup.ts index 6b9265ef53..7007f30b71 100644 --- a/packages/designer/tests/fixtures/component-metadata/abcgroup.ts +++ b/packages/designer/tests/fixtures/component-metadata/abcgroup.ts @@ -1,4 +1,4 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Abc.Group', npm: { @@ -6,7 +6,7 @@ export default { componentName: 'Div', }, title: { label: '容器' }, - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { @@ -228,8 +228,12 @@ export default { advanced: { isTopFixed: true, callbacks: { - onNodeAdd: (dragment, self) => { console.log(dragment); }, - onNodeRemove: (dragment, self) => { console.log(dragment); } + onNodeAdd: (dragment, self) => { + console.log(dragment); + }, + onNodeRemove: (dragment, self) => { + console.log(dragment); + }, }, initials: [ { diff --git a/packages/designer/tests/fixtures/component-metadata/abcitem.ts b/packages/designer/tests/fixtures/component-metadata/abcitem.ts index bbccf7119f..b45bcc9dc2 100644 --- a/packages/designer/tests/fixtures/component-metadata/abcitem.ts +++ b/packages/designer/tests/fixtures/component-metadata/abcitem.ts @@ -1,4 +1,4 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Abc.Item', npm: { @@ -6,7 +6,7 @@ export default { componentName: 'Div', }, title: { label: '容器' }, - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { @@ -228,8 +228,12 @@ export default { advanced: { isTopFixed: true, callbacks: { - onNodeAdd: (dragment, self) => { console.log(dragment); }, - onNodeRemove: (dragment, self) => { console.log(dragment); } + onNodeAdd: (dragment, self) => { + console.log(dragment); + }, + onNodeRemove: (dragment, self) => { + console.log(dragment); + }, }, initials: [ { diff --git a/packages/designer/tests/fixtures/component-metadata/abcnode.ts b/packages/designer/tests/fixtures/component-metadata/abcnode.ts index b991042a34..1383f9de25 100644 --- a/packages/designer/tests/fixtures/component-metadata/abcnode.ts +++ b/packages/designer/tests/fixtures/component-metadata/abcnode.ts @@ -1,4 +1,4 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Abc.Node', npm: { @@ -6,7 +6,7 @@ export default { componentName: 'Div', }, title: { label: '容器' }, - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { @@ -228,8 +228,12 @@ export default { advanced: { isTopFixed: true, callbacks: { - onNodeAdd: (dragment, self) => { console.log(dragment); }, - onNodeRemove: (dragment, self) => { console.log(dragment); } + onNodeAdd: (dragment, self) => { + console.log(dragment); + }, + onNodeRemove: (dragment, self) => { + console.log(dragment); + }, }, initials: [ { diff --git a/packages/designer/tests/fixtures/component-metadata/abcoption.ts b/packages/designer/tests/fixtures/component-metadata/abcoption.ts index 7d9d15a729..42ab2b294b 100644 --- a/packages/designer/tests/fixtures/component-metadata/abcoption.ts +++ b/packages/designer/tests/fixtures/component-metadata/abcoption.ts @@ -1,4 +1,4 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Abc.Option', npm: { @@ -6,7 +6,7 @@ export default { componentName: 'Div', }, title: { label: '容器' }, - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { @@ -228,8 +228,12 @@ export default { advanced: { isTopFixed: true, callbacks: { - onNodeAdd: (dragment, self) => { console.log(dragment); }, - onNodeRemove: (dragment, self) => { console.log(dragment); } + onNodeAdd: (dragment, self) => { + console.log(dragment); + }, + onNodeRemove: (dragment, self) => { + console.log(dragment); + }, }, initials: [ { diff --git a/packages/designer/tests/fixtures/component-metadata/button.ts b/packages/designer/tests/fixtures/component-metadata/button.ts index 55186a10c4..b5c1c71976 100644 --- a/packages/designer/tests/fixtures/component-metadata/button.ts +++ b/packages/designer/tests/fixtures/component-metadata/button.ts @@ -1,4 +1,4 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Button', npm: { @@ -6,7 +6,7 @@ export default { componentName: 'Button', }, title: '按钮', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { @@ -90,7 +90,7 @@ export default { name: 'c', title: 'c', setter: { - componentName: 'ColorSetter' + componentName: 'ColorSetter', }, }, ], @@ -254,7 +254,7 @@ export default { // parentWhitelist: 'Div', // childWhitelist: 'Div', }, - descriptor: 'xTitle' + descriptor: 'xTitle', }, supports: {}, }, diff --git a/packages/designer/tests/fixtures/component-metadata/dialog.ts b/packages/designer/tests/fixtures/component-metadata/dialog.ts index 5445d92a6b..d28b9d04d7 100644 --- a/packages/designer/tests/fixtures/component-metadata/dialog.ts +++ b/packages/designer/tests/fixtures/component-metadata/dialog.ts @@ -1,4 +1,4 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Dialog', npm: { @@ -6,7 +6,7 @@ export default { componentName: 'Dialog', }, title: '容器', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { diff --git a/packages/designer/tests/fixtures/component-metadata/div.ts b/packages/designer/tests/fixtures/component-metadata/div.ts index 96a5f76ba2..89b7ad240b 100644 --- a/packages/designer/tests/fixtures/component-metadata/div.ts +++ b/packages/designer/tests/fixtures/component-metadata/div.ts @@ -1,4 +1,4 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Div', npm: { @@ -6,7 +6,7 @@ export default { componentName: 'Div', }, title: '容器', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { @@ -231,8 +231,12 @@ export default { supports: {}, advanced: { callbacks: { - onNodeAdd: (dragment, self) => { console.log(dragment); }, - onNodeRemove: (dragment, self) => { console.log(dragment); } + onNodeAdd: (dragment, self) => { + console.log(dragment); + }, + onNodeRemove: (dragment, self) => { + console.log(dragment); + }, }, initials: [ { diff --git a/packages/designer/tests/fixtures/component-metadata/div10.ts b/packages/designer/tests/fixtures/component-metadata/div10.ts index 9b7c1c4876..e7219eace2 100644 --- a/packages/designer/tests/fixtures/component-metadata/div10.ts +++ b/packages/designer/tests/fixtures/component-metadata/div10.ts @@ -1,8 +1,8 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Div', title: '容器', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { diff --git a/packages/designer/tests/fixtures/component-metadata/div2.ts b/packages/designer/tests/fixtures/component-metadata/div2.ts index c9c1be306d..a2a9bbf167 100644 --- a/packages/designer/tests/fixtures/component-metadata/div2.ts +++ b/packages/designer/tests/fixtures/component-metadata/div2.ts @@ -1,4 +1,4 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Div', npm: { @@ -6,7 +6,7 @@ export default { componentName: 'Div', }, title: { label: '容器' }, - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { @@ -228,8 +228,12 @@ export default { advanced: { isTopFixed: true, callbacks: { - onNodeAdd: (dragment, self) => { console.log(dragment); }, - onNodeRemove: (dragment, self) => { console.log(dragment); } + onNodeAdd: (dragment, self) => { + console.log(dragment); + }, + onNodeRemove: (dragment, self) => { + console.log(dragment); + }, }, initials: [ { diff --git a/packages/designer/tests/fixtures/component-metadata/div3.ts b/packages/designer/tests/fixtures/component-metadata/div3.ts index ced3947f41..d293f8e1e4 100644 --- a/packages/designer/tests/fixtures/component-metadata/div3.ts +++ b/packages/designer/tests/fixtures/component-metadata/div3.ts @@ -1,11 +1,11 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Div', npm: { package: '@ali/vc-div', componentName: 'Div', }, - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { @@ -225,13 +225,17 @@ export default { nestingRule: { // parentWhitelist: 'Div', // childWhitelist: 'Div', - } + }, }, supports: {}, advanced: { callbacks: { - onNodeAdd: (dragment, self) => { console.log(dragment); }, - onNodeRemove: (dragment, self) => { console.log(dragment); } + onNodeAdd: (dragment, self) => { + console.log(dragment); + }, + onNodeRemove: (dragment, self) => { + console.log(dragment); + }, }, initials: [ { diff --git a/packages/designer/tests/fixtures/component-metadata/div4.ts b/packages/designer/tests/fixtures/component-metadata/div4.ts index cbe826fdcd..158b4ef789 100644 --- a/packages/designer/tests/fixtures/component-metadata/div4.ts +++ b/packages/designer/tests/fixtures/component-metadata/div4.ts @@ -1,11 +1,11 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Div', npm: { package: '@ali/vc-div', componentName: 'Div', }, - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: [ @@ -221,8 +221,12 @@ export default { ], experimental: { callbacks: { - onNodeAdd: (dragment, self) => { console.log(dragment); }, - onNodeRemove: (dragment, self) => { console.log(dragment); } + onNodeAdd: (dragment, self) => { + console.log(dragment); + }, + onNodeRemove: (dragment, self) => { + console.log(dragment); + }, }, initials: [ { diff --git a/packages/designer/tests/fixtures/component-metadata/div5.ts b/packages/designer/tests/fixtures/component-metadata/div5.ts index 963d7dd86d..f5685427d8 100644 --- a/packages/designer/tests/fixtures/component-metadata/div5.ts +++ b/packages/designer/tests/fixtures/component-metadata/div5.ts @@ -1,11 +1,11 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Div', npm: { package: '@ali/vc-div', componentName: 'Div', }, - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { @@ -231,8 +231,12 @@ export default { supports: {}, advanced: { callbacks: { - onNodeAdd: (dragment, self) => { console.log(dragment); }, - onNodeRemove: (dragment, self) => { console.log(dragment); } + onNodeAdd: (dragment, self) => { + console.log(dragment); + }, + onNodeRemove: (dragment, self) => { + console.log(dragment); + }, }, initials: [ { diff --git a/packages/designer/tests/fixtures/component-metadata/div6.ts b/packages/designer/tests/fixtures/component-metadata/div6.ts index de80a93641..15d1682264 100644 --- a/packages/designer/tests/fixtures/component-metadata/div6.ts +++ b/packages/designer/tests/fixtures/component-metadata/div6.ts @@ -1,11 +1,11 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Div', npm: { package: '@ali/vc-div', componentName: 'Div', }, - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { @@ -232,8 +232,12 @@ export default { }, experimental: { callbacks: { - onNodeAdd: (dragment, self) => { console.log(dragment); }, - onNodeRemove: (dragment, self) => { console.log(dragment); } + onNodeAdd: (dragment, self) => { + console.log(dragment); + }, + onNodeRemove: (dragment, self) => { + console.log(dragment); + }, }, initials: [ { diff --git a/packages/designer/tests/fixtures/component-metadata/div7.ts b/packages/designer/tests/fixtures/component-metadata/div7.ts index b970aa3a7b..2bc4c62f1f 100644 --- a/packages/designer/tests/fixtures/component-metadata/div7.ts +++ b/packages/designer/tests/fixtures/component-metadata/div7.ts @@ -1,4 +1,4 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Div', npm: { @@ -6,7 +6,7 @@ export default { componentName: 'Div', }, title: '容器', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { @@ -224,8 +224,12 @@ export default { supports: {}, advanced: { callbacks: { - onNodeAdd: (dragment, self) => { console.log(dragment); }, - onNodeRemove: (dragment, self) => { console.log(dragment); } + onNodeAdd: (dragment, self) => { + console.log(dragment); + }, + onNodeRemove: (dragment, self) => { + console.log(dragment); + }, }, initials: [ { diff --git a/packages/designer/tests/fixtures/component-metadata/div8.ts b/packages/designer/tests/fixtures/component-metadata/div8.ts index ae04ad287f..e67560b067 100644 --- a/packages/designer/tests/fixtures/component-metadata/div8.ts +++ b/packages/designer/tests/fixtures/component-metadata/div8.ts @@ -1,4 +1,4 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Div', npm: { @@ -6,7 +6,7 @@ export default { componentName: 'Div', }, title: '容器', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], } as IPublicTypeComponentMetadata; diff --git a/packages/designer/tests/fixtures/component-metadata/div9.ts b/packages/designer/tests/fixtures/component-metadata/div9.ts index 2d3640b3bd..4d34c375a3 100644 --- a/packages/designer/tests/fixtures/component-metadata/div9.ts +++ b/packages/designer/tests/fixtures/component-metadata/div9.ts @@ -1,8 +1,8 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Div', title: '容器', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], } as IPublicTypeComponentMetadata; diff --git a/packages/designer/tests/fixtures/component-metadata/form.ts b/packages/designer/tests/fixtures/component-metadata/form.ts index faa6e06085..b2fbdc8a4c 100644 --- a/packages/designer/tests/fixtures/component-metadata/form.ts +++ b/packages/designer/tests/fixtures/component-metadata/form.ts @@ -1,11 +1,11 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Form', npm: { package: '@ali/vc-form', }, title: '表单', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { diff --git a/packages/designer/tests/fixtures/component-metadata/other.ts b/packages/designer/tests/fixtures/component-metadata/other.ts index adc8659b8c..814d0ea7cb 100644 --- a/packages/designer/tests/fixtures/component-metadata/other.ts +++ b/packages/designer/tests/fixtures/component-metadata/other.ts @@ -1,11 +1,11 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Other', npm: { package: '@ali/vc-other', }, title: '容器', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { diff --git a/packages/designer/tests/fixtures/component-metadata/page.ts b/packages/designer/tests/fixtures/component-metadata/page.ts index 4170378614..5735bf0987 100644 --- a/packages/designer/tests/fixtures/component-metadata/page.ts +++ b/packages/designer/tests/fixtures/component-metadata/page.ts @@ -1,11 +1,11 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Page', npm: { package: '@ali/vc-page', }, title: '容器', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { diff --git a/packages/designer/tests/fixtures/component-metadata/page2.ts b/packages/designer/tests/fixtures/component-metadata/page2.ts index 4170378614..5735bf0987 100644 --- a/packages/designer/tests/fixtures/component-metadata/page2.ts +++ b/packages/designer/tests/fixtures/component-metadata/page2.ts @@ -1,11 +1,11 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'Page', npm: { package: '@ali/vc-page', }, title: '容器', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { diff --git a/packages/designer/tests/fixtures/component-metadata/root-content.ts b/packages/designer/tests/fixtures/component-metadata/root-content.ts index 5546e8b8a1..d7dc65c0ba 100644 --- a/packages/designer/tests/fixtures/component-metadata/root-content.ts +++ b/packages/designer/tests/fixtures/component-metadata/root-content.ts @@ -1,11 +1,11 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'RootContent', npm: { package: '@ali/vc-page', }, title: '容器', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { diff --git a/packages/designer/tests/fixtures/component-metadata/root-footer.ts b/packages/designer/tests/fixtures/component-metadata/root-footer.ts index cd3291fb07..34762e0c4d 100644 --- a/packages/designer/tests/fixtures/component-metadata/root-footer.ts +++ b/packages/designer/tests/fixtures/component-metadata/root-footer.ts @@ -1,11 +1,11 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'RootFooter', npm: { package: '@ali/vc-page', }, title: '容器', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { diff --git a/packages/designer/tests/fixtures/component-metadata/root-header.ts b/packages/designer/tests/fixtures/component-metadata/root-header.ts index b2d3dd4ed7..b98cbe9fb4 100644 --- a/packages/designer/tests/fixtures/component-metadata/root-header.ts +++ b/packages/designer/tests/fixtures/component-metadata/root-header.ts @@ -1,11 +1,11 @@ -import { IPublicTypeComponentMetadata } from "@alilc/lowcode-types"; +import { IPublicTypeComponentMetadata } from '@felce/lowcode-types'; export default { componentName: 'RootHeader', npm: { package: '@ali/vc-page', }, title: '容器', - docUrl: 'https://github.com/alibaba/lowcode-materials/tree/main/docs', + docUrl: 'https://github.com/fe-lce/lowcode-materials/tree/main/docs', devMode: 'proCode', tags: ['布局'], configure: { diff --git a/packages/designer/tests/plugin/plugin-manager.test.ts b/packages/designer/tests/plugin/plugin-manager.test.ts index 73915203f0..d14b2ba6f9 100644 --- a/packages/designer/tests/plugin/plugin-manager.test.ts +++ b/packages/designer/tests/plugin/plugin-manager.test.ts @@ -1,7 +1,7 @@ import '../fixtures/window'; -import { Editor, engineConfig } from '@alilc/lowcode-editor-core'; +import { Editor, engineConfig } from '@felce/lowcode-editor-core'; import { LowCodePluginManager } from '../../src/plugin/plugin-manager'; -import { IPublicModelPluginContext, IPublicApiPlugins } from '@alilc/lowcode-types'; +import { IPublicModelPluginContext, IPublicApiPlugins } from '@felce/lowcode-types'; import { ILowCodePluginContextPrivate } from '../../src/plugin/plugin-types'; const editor = new Editor(); @@ -11,10 +11,10 @@ describe('plugin 测试', () => { let pluginManager: IPublicApiPlugins; beforeEach(() => { contextApiAssembler = { - assembleApis(context: ILowCodePluginContextPrivate){ + assembleApis(context: ILowCodePluginContextPrivate) { context.plugins = pluginManager as IPublicApiPlugins; // mock set apis - } + }, }; pluginManager = new LowCodePluginManager(contextApiAssembler).toProxy(); }); diff --git a/packages/designer/tests/project/project-methods.test.ts b/packages/designer/tests/project/project-methods.test.ts index c710b29f13..091c7bb466 100644 --- a/packages/designer/tests/project/project-methods.test.ts +++ b/packages/designer/tests/project/project-methods.test.ts @@ -1,5 +1,5 @@ import '../fixtures/window'; -import { Editor } from '@alilc/lowcode-editor-core'; +import { Editor } from '@felce/lowcode-editor-core'; import { Project } from '../../src/project/project'; import { DocumentModel } from '../../src/document/document-model'; import { Designer } from '../../src/designer/designer'; @@ -46,37 +46,51 @@ describe.only('Project 方法测试', () => { }); it('load', () => { - project.load({ - componentsTree: [{ - componentName: 'Page', - fileName: 'f1', - }], - }, 'f1'); + project.load( + { + componentsTree: [ + { + componentName: 'Page', + fileName: 'f1', + }, + ], + }, + 'f1', + ); expect(project.currentDocument?.fileName).toBe('f1'); }); it.skip('setSchema', () => { - project.load({ - componentsTree: [{ - componentName: 'Page', - fileName: 'f1', - }], - }, true); + project.load( + { + componentsTree: [ + { + componentName: 'Page', + fileName: 'f1', + }, + ], + }, + true, + ); project.setSchema({ - componentsTree: [{ - componentName: 'Page', - props: { a: 1 }, - }], + componentsTree: [ + { + componentName: 'Page', + props: { a: 1 }, + }, + ], }); expect(project.currentDocument?.rootNode?.propsData).toEqual({ a: 1 }); }); it('open / getDocument / checkExclusive', () => { project.load({ - componentsTree: [{ - componentName: 'Page', - fileName: 'f1', - }], + componentsTree: [ + { + componentName: 'Page', + fileName: 'f1', + }, + ], }); const doc1 = project.createDocument({ componentName: 'Page', diff --git a/packages/designer/tests/project/project.test.ts b/packages/designer/tests/project/project.test.ts index 2066c03985..e72ea4f6a1 100644 --- a/packages/designer/tests/project/project.test.ts +++ b/packages/designer/tests/project/project.test.ts @@ -1,7 +1,7 @@ import set from 'lodash/set'; import cloneDeep from 'lodash/cloneDeep'; import '../fixtures/window'; -import { Editor } from '@alilc/lowcode-editor-core'; +import { Editor } from '@felce/lowcode-editor-core'; import { Project } from '../../src/project/project'; import { Designer } from '../../src/designer/designer'; import formSchema from '../fixtures/schema/form'; @@ -22,7 +22,9 @@ jest.mock('../../src/designer/designer', () => { }, }; }, - transformProps(props) { return props; }, + transformProps(props) { + return props; + }, createSettingEntry: mockCreateSettingEntry, postEvent() {}, }; @@ -44,9 +46,7 @@ describe('schema 生成节点模型测试', () => { it('基本的节点模型初始化,模型导出,初始化传入 schema', () => { const project = new Project(designer, { - componentsTree: [ - formSchema, - ], + componentsTree: [formSchema], }); project.open(); expect(project).toBeTruthy(); @@ -55,13 +55,15 @@ describe('schema 生成节点模型测试', () => { const ids = getIdsFromSchema(formSchema); const expectedNodeCnt = ids.length; expect(nodesMap.size).toBe(expectedNodeCnt); - ids.forEach(id => { - expect(nodesMap.get(id).componentName).toBe(getNodeFromSchemaById(formSchema, id).componentName); + ids.forEach((id) => { + expect(nodesMap.get(id).componentName).toBe( + getNodeFromSchemaById(formSchema, id).componentName, + ); }); const exportSchema = currentDocument?.export(1); expect(getIdsFromSchema(exportSchema).length).toBe(expectedNodeCnt); - nodesMap.forEach(node => { + nodesMap.forEach((node) => { // 触发 getter node.settingEntry; }); @@ -70,9 +72,7 @@ describe('schema 生成节点模型测试', () => { it('onSimulatorReady works', () => { const project = new Project(designer, { - componentsTree: [ - formSchema, - ], + componentsTree: [formSchema], }); project.open(); expect(project).toBeTruthy(); @@ -103,23 +103,26 @@ describe('schema 生成节点模型测试', () => { const project = new Project(designer); expect(project).toBeTruthy(); // trigger autoOpen case - project.load({ - componentsTree: [ - formSchema, - ], - }, true); + project.load( + { + componentsTree: [formSchema], + }, + true, + ); const { currentDocument } = project; const { nodesMap } = currentDocument; const ids = getIdsFromSchema(formSchema); const expectedNodeCnt = ids.length; expect(nodesMap.size).toBe(expectedNodeCnt); - ids.forEach(id => { - expect(nodesMap.get(id).componentName).toBe(getNodeFromSchemaById(formSchema, id).componentName); + ids.forEach((id) => { + expect(nodesMap.get(id).componentName).toBe( + getNodeFromSchemaById(formSchema, id).componentName, + ); }); const exportSchema = currentDocument?.export(1); expect(getIdsFromSchema(exportSchema).length).toBe(expectedNodeCnt); - nodesMap.forEach(node => { + nodesMap.forEach((node) => { // 触发 getter node.settingEntry; }); @@ -129,31 +132,34 @@ describe('schema 生成节点模型测试', () => { const project = new Project(designer); expect(project).toBeTruthy(); // trigger autoOpen case - project.load({ - componentsTree: [ - { - ...formSchema, - fileName: 'demoFile1', + project.load( + { + componentsTree: [ + { + ...formSchema, + fileName: 'demoFile1', + }, + { + ...formSchema, + fileName: 'demoFile2', + }, + ], + config: { + layout: { + props: { + tabBar: { + items: [ + { + path: '/demoFile2', + }, + ], + }, + }, + }, }, - { - ...formSchema, - fileName: 'demoFile2', - } - ], - config: { - layout: { - props: { - tabBar: { - items: [ - { - path: '/demoFile2', - } - ], - } - } - } - } - }, true); + }, + true, + ); const { currentDocument } = project; expect(currentDocument.fileName).toBe('demoFile2'); }); @@ -162,23 +168,25 @@ describe('schema 生成节点模型测试', () => { const project = new Project(designer); expect(project).toBeTruthy(); // trigger autoOpen case - project.load({ - componentsTree: [ - { - ...formSchema, - fileName: 'demoFile1', - }, - { - ...formSchema, - fileName: 'demoFile2', - } - ], - }, 'demoFile2'); + project.load( + { + componentsTree: [ + { + ...formSchema, + fileName: 'demoFile1', + }, + { + ...formSchema, + fileName: 'demoFile2', + }, + ], + }, + 'demoFile2', + ); const { currentDocument } = project; expect(currentDocument.fileName).toBe('demoFile2'); }); - it('setSchema works', () => { const project = new Project(designer); project.open(); @@ -204,13 +212,15 @@ describe('schema 生成节点模型测试', () => { const ids = getIdsFromSchema(formSchema); const expectedNodeCnt = ids.length; expect(nodesMap.size).toBe(expectedNodeCnt); - ids.forEach(id => { - expect(nodesMap.get(id).componentName).toBe(getNodeFromSchemaById(formSchema, id).componentName); + ids.forEach((id) => { + expect(nodesMap.get(id).componentName).toBe( + getNodeFromSchemaById(formSchema, id).componentName, + ); }); const exportSchema = currentDocument?.export(1); expect(getIdsFromSchema(exportSchema).length).toBe(expectedNodeCnt); - nodesMap.forEach(node => { + nodesMap.forEach((node) => { // 触发 getter node.settingEntry; }); @@ -271,11 +281,13 @@ describe('schema 生成节点模型测试', () => { describe('block ❌ | component ❌ | slot ✅', () => { it('基本的节点模型初始化,模型导出,初始化传入 schema', () => { - const formSchemaWithSlot = set(cloneDeep(formSchema), 'children[0].children[0].props.title.type', 'JSSlot'); + const formSchemaWithSlot = set( + cloneDeep(formSchema), + 'children[0].children[0].props.title.type', + 'JSSlot', + ); const project = new Project(designer, { - componentsTree: [ - formSchemaWithSlot, - ], + componentsTree: [formSchemaWithSlot], }); project.open(); expect(project).toBeTruthy(); @@ -290,7 +302,5 @@ describe('schema 生成节点模型测试', () => { }); }); - describe.skip('多 document 测试', () => { - - }); + describe.skip('多 document 测试', () => {}); }); diff --git a/packages/editor-core/jest.config.js b/packages/editor-core/jest.config.js index e8441e3dbb..f95766c528 100644 --- a/packages/editor-core/jest.config.js +++ b/packages/editor-core/jest.config.js @@ -1,12 +1,10 @@ const fs = require('fs'); const { join } = require('path'); const esModules = [].join('|'); -const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.')); +const pkgNames = fs.readdirSync(join('..')).filter((pkgName) => !pkgName.startsWith('.')); const jestConfig = { - transformIgnorePatterns: [ - `/node_modules/(?!${esModules})/`, - ], + transformIgnorePatterns: [`/node_modules/(?!${esModules})/`], moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], collectCoverage: false, collectCoverageFrom: [ @@ -21,6 +19,6 @@ const jestConfig = { // 只对本仓库内的 pkg 做 mapping jestConfig.moduleNameMapper = {}; -jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; +jestConfig.moduleNameMapper[`^@felce/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; -module.exports = jestConfig; \ No newline at end of file +module.exports = jestConfig; diff --git a/packages/editor-core/package.json b/packages/editor-core/package.json index 55f6d50c39..4775509fb9 100644 --- a/packages/editor-core/package.json +++ b/packages/editor-core/package.json @@ -1,6 +1,6 @@ { - "name": "@alilc/lowcode-editor-core", - "version": "1.3.2", + "name": "@felce/lowcode-editor-core", + "version": "1.4.0", "description": "Core Api for Ali lowCode engine", "license": "MIT", "main": "lib/index.js", @@ -15,9 +15,9 @@ "test:cov": "build-scripts test --config build.test.json --jest-coverage" }, "dependencies": { - "@alifd/next": "^1.19.16", - "@alilc/lowcode-types": "1.3.2", - "@alilc/lowcode-utils": "1.3.2", + "@alifd/next": "^1.26.0", + "@felce/lowcode-types": "1.4.0", + "@felce/lowcode-utils": "1.4.0", "classnames": "^2.2.6", "debug": "^4.1.1", "intl-messageformat": "^9.3.1", @@ -47,9 +47,9 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-core" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/packages/editor-core" }, "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/packages/editor-core/src/command.ts b/packages/editor-core/src/command.ts index 7facc33d94..e5abcf372f 100644 --- a/packages/editor-core/src/command.ts +++ b/packages/editor-core/src/command.ts @@ -1,11 +1,25 @@ -import { IPublicApiCommand, IPublicEnumTransitionType, IPublicModelPluginContext, IPublicTypeCommand, IPublicTypeCommandHandlerArgs, IPublicTypeListCommand } from '@alilc/lowcode-types'; -import { checkPropTypes } from '@alilc/lowcode-utils'; -export interface ICommand extends Omit<IPublicApiCommand, 'registerCommand' | 'batchExecuteCommand'> { - registerCommand(command: IPublicTypeCommand, options?: { - commandScope?: string; - }): void; +import { + IPublicApiCommand, + IPublicEnumTransitionType, + IPublicModelPluginContext, + IPublicTypeCommand, + IPublicTypeCommandHandlerArgs, + IPublicTypeListCommand, +} from '@felce/lowcode-types'; +import { checkPropTypes } from '@felce/lowcode-utils'; +export interface ICommand + extends Omit<IPublicApiCommand, 'registerCommand' | 'batchExecuteCommand'> { + registerCommand( + command: IPublicTypeCommand, + options?: { + commandScope?: string; + }, + ): void; - batchExecuteCommand(commands: { name: string; args: IPublicTypeCommandHandlerArgs }[], pluginContext?: IPublicModelPluginContext): void; + batchExecuteCommand( + commands: { name: string; args: IPublicTypeCommandHandlerArgs }[], + pluginContext?: IPublicModelPluginContext, + ): void; } export interface ICommandOptions { @@ -42,7 +56,7 @@ export class Command implements ICommand { if (!command) { throw new Error(`Command '${name}' is not registered.`); } - command.parameters?.forEach(d => { + command.parameters?.forEach((d) => { if (!checkPropTypes(args[d.name], d.name, d.propType, 'command')) { throw new Error(`Command '${name}' arguments ${d.name} is invalid.`); } @@ -51,24 +65,27 @@ export class Command implements ICommand { command.handler(args); } catch (error) { if (this.commandErrors && this.commandErrors.length) { - this.commandErrors.forEach(callback => callback(name, error)); + this.commandErrors.forEach((callback) => callback(name, error)); } else { throw error; } } } - batchExecuteCommand(commands: { name: string; args: IPublicTypeCommandHandlerArgs }[], pluginContext: IPublicModelPluginContext): void { + batchExecuteCommand( + commands: { name: string; args: IPublicTypeCommandHandlerArgs }[], + pluginContext: IPublicModelPluginContext, + ): void { if (!commands || !commands.length) { return; } pluginContext.common.utils.executeTransaction(() => { - commands.forEach(command => this.executeCommand(command.name, command.args)); + commands.forEach((command) => this.executeCommand(command.name, command.args)); }, IPublicEnumTransitionType.REPAINT); } listCommands(): IPublicTypeListCommand[] { - return Array.from(this.commands.values()).map(d => { + return Array.from(this.commands.values()).map((d) => { const result: IPublicTypeListCommand = { name: d.name, }; diff --git a/packages/editor-core/src/config.ts b/packages/editor-core/src/config.ts index c4ff407b9a..dc6dbdbeb0 100644 --- a/packages/editor-core/src/config.ts +++ b/packages/editor-core/src/config.ts @@ -1,10 +1,10 @@ import { get as lodashGet } from 'lodash'; -import { isPlainObject } from '@alilc/lowcode-utils'; +import { isPlainObject } from '@felce/lowcode-utils'; import { IPublicTypeEngineOptions, IPublicModelEngineConfig, IPublicModelPreference, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { getLogger } from './utils/logger'; import Preference from './utils/preference'; @@ -55,7 +55,8 @@ const VALID_ENGINE_OPTIONS = { enableStrictPluginMode: { type: 'boolean', default: STRICT_PLUGIN_MODE_DEFAULT, - description: '开启严格插件模式,默认值:STRICT_PLUGIN_MODE_DEFAULT , 严格模式下,插件将无法通过 engineOptions 传递自定义配置项', + description: + '开启严格插件模式,默认值:STRICT_PLUGIN_MODE_DEFAULT , 严格模式下,插件将无法通过 engineOptions 传递自定义配置项', }, enableReactiveContainer: { type: 'boolean', @@ -75,7 +76,8 @@ const VALID_ENGINE_OPTIONS = { customizeIgnoreSelectors: { type: 'function', default: undefined, - description: '定制画布中点击被忽略的 selectors, eg. (defaultIgnoreSelectors: string[], e: MouseEvent) => string[]', + description: + '定制画布中点击被忽略的 selectors, eg. (defaultIgnoreSelectors: string[], e: MouseEvent) => string[]', }, disableDefaultSettingPanel: { type: 'boolean', @@ -171,19 +173,23 @@ const VALID_ENGINE_OPTIONS = { }, }; -const getStrictModeValue = (engineOptions: IPublicTypeEngineOptions, defaultValue: boolean): boolean => { +const getStrictModeValue = ( + engineOptions: IPublicTypeEngineOptions, + defaultValue: boolean, +): boolean => { if (!engineOptions || !isPlainObject(engineOptions)) { return defaultValue; } - if (engineOptions.enableStrictPluginMode === undefined - || engineOptions.enableStrictPluginMode === null) { + if ( + engineOptions.enableStrictPluginMode === undefined || + engineOptions.enableStrictPluginMode === null + ) { return defaultValue; } return engineOptions.enableStrictPluginMode; }; export interface IEngineConfig extends IPublicModelEngineConfig { - /** * if engineOptions.strictPluginMode === true, only accept propertied predefined in EngineOptions. * @@ -202,11 +208,11 @@ export class EngineConfig implements IEngineConfig { private config: { [key: string]: any } = {}; private waits = new Map< - string, - Array<{ - once?: boolean; - resolve: (data: any) => void; - }> + string, + Array<{ + once?: boolean; + resolve: (data: any) => void; + }> >(); /** @@ -278,7 +284,10 @@ export class EngineConfig implements IEngineConfig { if (isValidKey(key)) { this.set(key, (engineOptions as any)[key]); } else { - logger.warn(`failed to config ${key} to engineConfig, only predefined options can be set under strict mode, predefined options: `, VALID_ENGINE_OPTIONS); + logger.warn( + `failed to config ${key} to engineConfig, only predefined options can be set under strict mode, predefined options: `, + VALID_ENGINE_OPTIONS, + ); } }); } else { diff --git a/packages/editor-core/src/di/setter.ts b/packages/editor-core/src/di/setter.ts index 5af2c0230f..8a75848cd2 100644 --- a/packages/editor-core/src/di/setter.ts +++ b/packages/editor-core/src/di/setter.ts @@ -1,16 +1,24 @@ import { ReactNode } from 'react'; -import { IPublicApiSetters, IPublicModelSettingField, IPublicTypeCustomView, IPublicTypeRegisteredSetter } from '@alilc/lowcode-types'; -import { createContent, isCustomView } from '@alilc/lowcode-utils'; +import { + IPublicApiSetters, + IPublicModelSettingField, + IPublicTypeCustomView, + IPublicTypeRegisteredSetter, +} from '@felce/lowcode-types'; +import { createContent, isCustomView } from '@felce/lowcode-utils'; -const settersMap = new Map<string, IPublicTypeRegisteredSetter & { - type: string; -}>(); +const settersMap = new Map< + string, + IPublicTypeRegisteredSetter & { + type: string; + } +>(); export function registerSetter( typeOrMaps: string | { [key: string]: IPublicTypeCustomView | IPublicTypeRegisteredSetter }, setter?: IPublicTypeCustomView | IPublicTypeRegisteredSetter, ) { if (typeof typeOrMaps === 'object') { - Object.keys(typeOrMaps).forEach(type => { + Object.keys(typeOrMaps).forEach((type) => { registerSetter(type, typeOrMaps[type]); }); return; @@ -37,20 +45,24 @@ export function registerSetter( } function getInitialFromSetter(setter: any) { - return setter && ( - setter.initial || setter.Initial - || (setter.type && (setter.type.initial || setter.type.Initial)) - ) || null; // eslint-disable-line + return ( + (setter && + (setter.initial || + setter.Initial || + (setter.type && (setter.type.initial || setter.type.Initial)))) || + null + ); // eslint-disable-line } -export interface ISetters extends IPublicApiSetters { - -} +export interface ISetters extends IPublicApiSetters {} export class Setters implements ISetters { - settersMap = new Map<string, IPublicTypeRegisteredSetter & { - type: string; - }>(); + settersMap = new Map< + string, + IPublicTypeRegisteredSetter & { + type: string; + } + >(); constructor(readonly viewName: string = 'global') {} @@ -63,7 +75,7 @@ export class Setters implements ISetters { setter?: IPublicTypeCustomView | IPublicTypeRegisteredSetter, ) => { if (typeof typeOrMaps === 'object') { - Object.keys(typeOrMaps).forEach(type => { + Object.keys(typeOrMaps).forEach((type) => { this.registerSetter(type, typeOrMaps[type]); }); return; @@ -115,4 +127,4 @@ export class Setters implements ISetters { return createContent(setter, props); }; -} \ No newline at end of file +} diff --git a/packages/editor-core/src/editor.ts b/packages/editor-core/src/editor.ts index f31a2a2dda..5b685591d5 100644 --- a/packages/editor-core/src/editor.ts +++ b/packages/editor-core/src/editor.ts @@ -13,11 +13,11 @@ import { IPublicTypeComponentDescription, IPublicTypeRemoteComponentDescription, GlobalEvent, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { engineConfig } from './config'; import { globalLocale } from './intl'; import { obx } from './utils'; -import { IPublicTypeAssetsJson, AssetLoader } from '@alilc/lowcode-utils'; +import { IPublicTypeAssetsJson, AssetLoader } from '@felce/lowcode-utils'; import { assetsTransform } from './utils/assets-transform'; EventEmitter.defaultMaxListeners = 100; @@ -68,7 +68,6 @@ export interface IEditor extends IPublicModelEditor { // eslint-disable-next-line no-redeclare export class Editor extends EventEmitter implements IEditor { - /** * Ioc Container */ @@ -96,7 +95,10 @@ export class Editor extends EventEmitter implements IEditor { }> >(); - constructor(readonly viewName: string = 'global', readonly workspaceMode: boolean = false) { + constructor( + readonly viewName: string = 'global', + readonly workspaceMode: boolean = false, + ) { // eslint-disable-next-line constructor-super super(); // set global emitter maxListeners @@ -105,8 +107,8 @@ export class Editor extends EventEmitter implements IEditor { } get<T = undefined, KeyOrType = any>( - keyOrType: KeyOrType, - ): IPublicTypeEditorGetResult<T, KeyOrType> | undefined { + keyOrType: KeyOrType, + ): IPublicTypeEditorGetResult<T, KeyOrType> | undefined { return this.context.get(keyOrType as any); } @@ -147,59 +149,75 @@ export class Editor extends EventEmitter implements IEditor { // 如果有远程组件描述协议,则自动加载并补充到资产包中,同时出发 designer.incrementalAssetsReady 通知组件面板更新数据 if (remoteComponentDescriptions && remoteComponentDescriptions.length) { await Promise.all( - remoteComponentDescriptions.map(async (component: IPublicTypeRemoteComponentDescription) => { - const { exportName, url, npm } = component; - if (!url || !exportName) { - return; - } - if (!AssetsCache[exportName] || !npm?.version || AssetsCache[exportName].npm?.version !== npm?.version) { - await (new AssetLoader()).load(url); - } - AssetsCache[exportName] = component; - function setAssetsComponent(component: any, extraNpmInfo: any = {}) { - const components = component.components; - assets.componentList = assets.componentList?.concat(component.componentList || []); - if (Array.isArray(components)) { - components.forEach(d => { - assets.components = assets.components.concat({ - npm: { - ...npm, - ...extraNpmInfo, - }, - ...d, - } || []); - }); + remoteComponentDescriptions.map( + async (component: IPublicTypeRemoteComponentDescription) => { + const { exportName, url, npm } = component; + if (!url || !exportName) { return; } - if (component.components) { - assets.components = assets.components.concat({ - npm: { - ...npm, - ...extraNpmInfo, - }, - ...component.components, - } || []); + if ( + !AssetsCache[exportName] || + !npm?.version || + AssetsCache[exportName].npm?.version !== npm?.version + ) { + await new AssetLoader().load(url); } - } - function setArrayAssets(value: any[], preExportName: string = '', preSubName: string = '') { - value.forEach((d: any, i: number) => { - const exportName = [preExportName, i.toString()].filter(d => !!d).join('.'); - const subName = [preSubName, i.toString()].filter(d => !!d).join('.'); - Array.isArray(d) ? setArrayAssets(d, exportName, subName) : setAssetsComponent(d, { - exportName, - subName, + AssetsCache[exportName] = component; + function setAssetsComponent(component: any, extraNpmInfo: any = {}) { + const components = component.components; + assets.componentList = assets.componentList?.concat(component.componentList || []); + if (Array.isArray(components)) { + components.forEach((d) => { + assets.components = assets.components.concat( + { + npm: { + ...npm, + ...extraNpmInfo, + }, + ...d, + } || [], + ); + }); + return; + } + if (component.components) { + assets.components = assets.components.concat( + { + npm: { + ...npm, + ...extraNpmInfo, + }, + ...component.components, + } || [], + ); + } + } + function setArrayAssets( + value: any[], + preExportName: string = '', + preSubName: string = '', + ) { + value.forEach((d: any, i: number) => { + const exportName = [preExportName, i.toString()].filter((d) => !!d).join('.'); + const subName = [preSubName, i.toString()].filter((d) => !!d).join('.'); + Array.isArray(d) + ? setArrayAssets(d, exportName, subName) + : setAssetsComponent(d, { + exportName, + subName, + }); }); - }); - } - if ((window as any)[exportName]) { - if (Array.isArray((window as any)[exportName])) { - setArrayAssets((window as any)[exportName] as any); - } else { - setAssetsComponent((window as any)[exportName] as any); } - } - return (window as any)[exportName]; - }), + if ((window as any)[exportName]) { + if (Array.isArray((window as any)[exportName])) { + setArrayAssets((window as any)[exportName] as any); + } else { + setAssetsComponent((window as any)[exportName] as any); + } + } + return (window as any)[exportName]; + }, + ), ); } } @@ -208,7 +226,9 @@ export class Editor extends EventEmitter implements IEditor { this.notifyGot('assets'); } - onceGot<T = undefined, KeyOrType extends IPublicTypeEditorValueKey = any>(keyOrType: KeyOrType): Promise<IPublicTypeEditorGetResult<T, KeyOrType>> { + onceGot<T = undefined, KeyOrType extends IPublicTypeEditorValueKey = any>( + keyOrType: KeyOrType, + ): Promise<IPublicTypeEditorGetResult<T, KeyOrType>> { const x = this.context.get(keyOrType); if (x !== undefined) { return Promise.resolve(x); @@ -253,7 +273,7 @@ export class Editor extends EventEmitter implements IEditor { const { hooks = [], lifeCycles } = this.config; this.emit('editor.beforeInit'); - const init = (lifeCycles && lifeCycles.init) || ((): void => { }); + const init = (lifeCycles && lifeCycles.init) || ((): void => {}); try { await init(this); @@ -298,7 +318,7 @@ export class Editor extends EventEmitter implements IEditor { registerHooks = (hooks: HookConfig[]) => { this.initHooks(hooks).forEach(({ message, type, handler }) => { if (['on', 'once'].indexOf(type) !== -1) { - this[type]((message as any), handler); + this[type](message as any, handler); } }); }; diff --git a/packages/editor-core/src/event-bus.ts b/packages/editor-core/src/event-bus.ts index ae9d28905b..ee76da2840 100644 --- a/packages/editor-core/src/event-bus.ts +++ b/packages/editor-core/src/event-bus.ts @@ -1,5 +1,5 @@ -import { IPublicApiEvent } from '@alilc/lowcode-types'; -import { Logger } from '@alilc/lowcode-utils'; +import { IPublicApiEvent } from '@felce/lowcode-types'; +import { Logger } from '@felce/lowcode-utils'; import EventEmitter from 'events'; const logger = new Logger({ level: 'warn', bizName: 'event-bus' }); @@ -106,4 +106,4 @@ export const createModuleEventBus = (moduleName: string, maxListeners?: number): emitter.setMaxListeners(maxListeners); } return new EventBus(emitter, moduleName); -}; \ No newline at end of file +}; diff --git a/packages/editor-core/src/hotkey.ts b/packages/editor-core/src/hotkey.ts index d0dd40cc24..82c1b63b43 100644 --- a/packages/editor-core/src/hotkey.ts +++ b/packages/editor-core/src/hotkey.ts @@ -1,6 +1,11 @@ import { isEqual } from 'lodash'; import { globalContext } from './di'; -import { IPublicTypeHotkeyCallback, IPublicTypeHotkeyCallbackConfig, IPublicTypeHotkeyCallbacks, IPublicApiHotkey } from '@alilc/lowcode-types'; +import { + IPublicTypeHotkeyCallback, + IPublicTypeHotkeyCallbackConfig, + IPublicTypeHotkeyCallbacks, + IPublicApiHotkey, +} from '@felce/lowcode-types'; interface KeyMap { [key: number]: string; @@ -110,7 +115,7 @@ let REVERSE_MAP: CtrlKeyMap; * programatically */ for (let i = 1; i < 20; ++i) { - MAP[111 + i] = `f${ i}`; + MAP[111 + i] = `f${i}`; } /** @@ -314,7 +319,12 @@ function getKeyInfo(combination: string, action?: string): KeyInfo { * if your callback function returns false this will use the jquery * convention - prevent default and stop propogation on the event */ -function fireCallback(callback: IPublicTypeHotkeyCallback, e: KeyboardEvent, combo?: string, sequence?: string): void { +function fireCallback( + callback: IPublicTypeHotkeyCallback, + e: KeyboardEvent, + combo?: string, + sequence?: string, +): void { try { const workspace = globalContext.get('workspace'); const editor = workspace.isActive ? workspace.window?.editor : globalContext.get('editor'); @@ -322,7 +332,9 @@ function fireCallback(callback: IPublicTypeHotkeyCallback, e: KeyboardEvent, com const node = designer?.currentSelection?.getNodes()?.[0]; const npm = node?.componentMeta?.npm; const selected = - [npm?.package, npm?.componentName].filter((item) => !!item).join('-') || node?.componentMeta?.componentName || ''; + [npm?.package, npm?.componentName].filter((item) => !!item).join('-') || + node?.componentMeta?.componentName || + ''; if (callback(e, combo) === false) { e.preventDefault(); e.stopPropagation(); @@ -389,10 +401,10 @@ export class Hotkey implements IHotKey { unbind(combos: string[] | string, callback: IPublicTypeHotkeyCallback, action?: string) { const combinations = Array.isArray(combos) ? combos : [combos]; - combinations.forEach(combination => { + combinations.forEach((combination) => { const info: KeyInfo = getKeyInfo(combination, action); const { key, modifiers } = info; - const idx = this.callBacks[key].findIndex(info => { + const idx = this.callBacks[key].findIndex((info) => { return isEqual(info.modifiers, modifiers) && info.callback === callback; }); if (idx !== -1) { @@ -471,9 +483,13 @@ export class Hotkey implements IHotKey { // chrome will not fire a keypress if meta or control is down // safari will fire a keypress if meta or meta+shift is down // firefox will fire a keypress if meta or control is down - if ((isPressEvent(e) && !e.metaKey && !e.ctrlKey) || modifiersMatch(modifiers, callback.modifiers)) { + if ( + (isPressEvent(e) && !e.metaKey && !e.ctrlKey) || + modifiersMatch(modifiers, callback.modifiers) + ) { const deleteCombo = !sequenceName && callback.combo === combination; - const deleteSequence = sequenceName && callback.seq === sequenceName && callback.level === level; + const deleteSequence = + sequenceName && callback.seq === sequenceName && callback.level === level; if (deleteCombo || deleteSequence) { this.callBacks[character].splice(i, 1); } @@ -568,7 +584,12 @@ export class Hotkey implements IHotKey { this.resetTimer = window.setTimeout(this.resetSequences, 1000); } - private bindSequence(combo: string, keys: string[], callback: IPublicTypeHotkeyCallback, action?: string): void { + private bindSequence( + combo: string, + keys: string[], + callback: IPublicTypeHotkeyCallback, + action?: string, + ): void { // const self: any = this; this.sequenceLevels[combo] = 0; const increaseSequence = (nextAction: string) => { @@ -589,7 +610,9 @@ export class Hotkey implements IHotKey { }; for (let i = 0; i < keys.length; ++i) { const isFinal = i + 1 === keys.length; - const wrappedCallback = isFinal ? callbackAndReset : increaseSequence(action || getKeyInfo(keys[i + 1]).action); + const wrappedCallback = isFinal + ? callbackAndReset + : increaseSequence(action || getKeyInfo(keys[i + 1]).action); this.bindSingle(keys[i], wrappedCallback, action, combo, i); } } @@ -623,7 +646,14 @@ export class Hotkey implements IHotKey { this.callBacks[info.key] = this.callBacks[info.key] || []; // remove an existing match if there is one - this.getMatches(info.key, info.modifiers, { type: info.action }, sequenceName, combination, level); + this.getMatches( + info.key, + info.modifiers, + { type: info.action }, + sequenceName, + combination, + level, + ); // add this call back to the array // if it is a sequence put it at the beginning @@ -641,7 +671,11 @@ export class Hotkey implements IHotKey { }); } - private bindMultiple(combinations: string[], callback: IPublicTypeHotkeyCallback, action?: string) { + private bindMultiple( + combinations: string[], + callback: IPublicTypeHotkeyCallback, + action?: string, + ) { for (const item of combinations) { this.bindSingle(item, callback, action); } diff --git a/packages/editor-core/src/intl/global-locale.ts b/packages/editor-core/src/intl/global-locale.ts index fd67bb51f9..66e3e24fc7 100644 --- a/packages/editor-core/src/intl/global-locale.ts +++ b/packages/editor-core/src/intl/global-locale.ts @@ -1,6 +1,6 @@ import { IEventBus, createModuleEventBus } from '../event-bus'; import { obx, computed } from '../utils/obx'; -import { Logger } from '@alilc/lowcode-utils'; +import { Logger } from '@felce/lowcode-utils'; const logger = new Logger({ level: 'warn', bizName: 'globalLocale' }); @@ -72,7 +72,7 @@ class GlobalLocale { // store 3: config from system const { navigator } = window as any; if (navigator.language) { - const lang = (navigator.language as string); + const lang = navigator.language as string; return languageMap[lang] || lang.replace('_', '-'); } else if (navigator.browserLanguage) { const it = navigator.browserLanguage.split('-'); @@ -85,7 +85,9 @@ class GlobalLocale { } } if (!result) { - logger.warn('something when wrong when trying to get locale, use zh-CN as default, please check it out!'); + logger.warn( + 'something when wrong when trying to get locale, use zh-CN as default, please check it out!', + ); result = 'zh-CN'; } this._locale = result; @@ -136,11 +138,7 @@ class GlobalLocale { function getConfig(name: string) { const win: any = window; - return ( - win[name] - || (win.g_config || {})[name] - || (win.pageConfig || {})[name] - ); + return win[name] || (win.g_config || {})[name] || (win.pageConfig || {})[name]; } function hasLocalStorage(obj: any): obj is WindowLocalStorage { diff --git a/packages/editor-core/src/intl/index.ts b/packages/editor-core/src/intl/index.ts index 99e99a4fb9..f246ab5658 100644 --- a/packages/editor-core/src/intl/index.ts +++ b/packages/editor-core/src/intl/index.ts @@ -1,9 +1,9 @@ import { ReactNode, Component, createElement } from 'react'; import { IntlMessageFormat } from 'intl-messageformat'; import { globalLocale } from './global-locale'; -import { isI18nData } from '@alilc/lowcode-utils'; +import { isI18nData } from '@felce/lowcode-utils'; import { observer } from '../utils'; -import { IPublicTypeI18nData } from '@alilc/lowcode-types'; +import { IPublicTypeI18nData } from '@felce/lowcode-types'; function generateTryLocales(locale: string) { const tries = [locale, locale.replace('-', '_')]; @@ -56,7 +56,7 @@ export function shallowIntl(data: any): any { return data; } const maps: any = {}; - Object.keys(data).forEach(key => { + Object.keys(data).forEach((key) => { maps[key] = intl(data[key]); }); return maps; @@ -81,14 +81,12 @@ class IntlElement extends Component<{ data: any; params?: object }> { } } -export function createIntl( - instance: string | object, -): { - intlNode(id: string, params?: object): ReactNode; - intl(id: string, params?: object): string; - getLocale(): string; - setLocale(locale: string): void; - } { +export function createIntl(instance: string | object): { + intlNode(id: string, params?: object): ReactNode; + intl(id: string, params?: object): string; + getLocale(): string; + setLocale(locale: string): void; +} { // TODO: make reactive const data = (() => { const locale = globalLocale.getLocale(); diff --git a/packages/editor-core/src/utils/assets-transform.ts b/packages/editor-core/src/utils/assets-transform.ts index 013338751b..d1286c2e04 100644 --- a/packages/editor-core/src/utils/assets-transform.ts +++ b/packages/editor-core/src/utils/assets-transform.ts @@ -1,28 +1,38 @@ /* eslint-disable no-param-reassign */ -import { IPublicTypeAssetsJson, IPublicTypeComponentDescription, IPublicTypePackage, IPublicTypeRemoteComponentDescription } from '@alilc/lowcode-types'; +import { + IPublicTypeAssetsJson, + IPublicTypeComponentDescription, + IPublicTypePackage, + IPublicTypeRemoteComponentDescription, +} from '@felce/lowcode-types'; // TODO: 该转换逻辑未来需要消化掉 export function assetsTransform(assets: IPublicTypeAssetsJson) { const { components, packages } = assets; - const packageMaps = (packages || []).reduce((acc: Record<string, IPublicTypePackage>, cur: IPublicTypePackage) => { - const key = cur.id || cur.package || ''; - acc[key] = cur; - return acc; - }, {} as any); - components.forEach((componentDesc: IPublicTypeComponentDescription | IPublicTypeRemoteComponentDescription) => { - let { devMode, schema, reference } = componentDesc; - if ((devMode as string) === 'lowcode') { - devMode = 'lowCode'; - } else if (devMode === 'proCode') { - devMode = 'proCode'; - } - if (devMode) { - componentDesc.devMode = devMode; - } - if (devMode === 'lowCode' && !schema && reference) { - const referenceId = reference.id || ''; - componentDesc.schema = packageMaps[referenceId].schema; - } - }); + const packageMaps = (packages || []).reduce( + (acc: Record<string, IPublicTypePackage>, cur: IPublicTypePackage) => { + const key = cur.id || cur.package || ''; + acc[key] = cur; + return acc; + }, + {} as any, + ); + components.forEach( + (componentDesc: IPublicTypeComponentDescription | IPublicTypeRemoteComponentDescription) => { + let { devMode, schema, reference } = componentDesc; + if ((devMode as string) === 'lowcode') { + devMode = 'lowCode'; + } else if (devMode === 'proCode') { + devMode = 'proCode'; + } + if (devMode) { + componentDesc.devMode = devMode; + } + if (devMode === 'lowCode' && !schema && reference) { + const referenceId = reference.id || ''; + componentDesc.schema = packageMaps[referenceId].schema; + } + }, + ); return assets; -} \ No newline at end of file +} diff --git a/packages/editor-core/src/utils/logger.ts b/packages/editor-core/src/utils/logger.ts index 212dcddab1..6c67777da7 100644 --- a/packages/editor-core/src/utils/logger.ts +++ b/packages/editor-core/src/utils/logger.ts @@ -1,4 +1,4 @@ -import { Logger, Level } from '@alilc/lowcode-utils'; +import { Logger, Level } from '@felce/lowcode-utils'; export { Logger }; diff --git a/packages/editor-core/src/utils/preference.ts b/packages/editor-core/src/utils/preference.ts index 6f17a8f638..2f6fda764b 100644 --- a/packages/editor-core/src/utils/preference.ts +++ b/packages/editor-core/src/utils/preference.ts @@ -1,6 +1,6 @@ import store from 'store'; import { getLogger } from './logger'; -import { IPublicModelPreference } from '@alilc/lowcode-types'; +import { IPublicModelPreference } from '@felce/lowcode-types'; const logger = getLogger({ level: 'warn', bizName: 'Preference' }); const STORAGE_KEY_PREFIX = 'ale'; @@ -52,4 +52,4 @@ export default class Preference implements IPublicModelPreference { return !(result === undefined || result === null); } -} \ No newline at end of file +} diff --git a/packages/editor-core/src/widgets/tip/help-tips.tsx b/packages/editor-core/src/widgets/tip/help-tips.tsx index ab5f65050e..4928807809 100644 --- a/packages/editor-core/src/widgets/tip/help-tips.tsx +++ b/packages/editor-core/src/widgets/tip/help-tips.tsx @@ -1,4 +1,4 @@ -import { IPublicTypeHelpTipConfig, IPublicTypeTipConfig } from '@alilc/lowcode-types'; +import { IPublicTypeHelpTipConfig, IPublicTypeTipConfig } from '@felce/lowcode-types'; import { Tip } from './tip'; import { Icon } from '@alifd/next'; import { IconProps } from '@alifd/next/types/icon'; @@ -37,4 +37,4 @@ export function HelpTip({ <Tip direction={direction}>{help.content}</Tip> </div> ); -} \ No newline at end of file +} diff --git a/packages/editor-core/src/widgets/tip/tip-handler.ts b/packages/editor-core/src/widgets/tip/tip-handler.ts index 63193ea854..f60a4d5ce2 100644 --- a/packages/editor-core/src/widgets/tip/tip-handler.ts +++ b/packages/editor-core/src/widgets/tip/tip-handler.ts @@ -1,4 +1,4 @@ -import { IPublicTypeTipConfig } from '@alilc/lowcode-types'; +import { IPublicTypeTipConfig } from '@felce/lowcode-types'; import { IEventBus, createModuleEventBus } from '../../event-bus'; export interface TipOptions extends IPublicTypeTipConfig { diff --git a/packages/editor-core/src/widgets/tip/tip-item.tsx b/packages/editor-core/src/widgets/tip/tip-item.tsx index c56d747ffa..1712024d1b 100644 --- a/packages/editor-core/src/widgets/tip/tip-item.tsx +++ b/packages/editor-core/src/widgets/tip/tip-item.tsx @@ -1,6 +1,6 @@ import { Component } from 'react'; import classNames from 'classnames'; -import { IPublicTypeTipConfig } from '@alilc/lowcode-types'; +import { IPublicTypeTipConfig } from '@felce/lowcode-types'; import { intl } from '../../intl'; import { resolvePosition } from './utils'; import { tipHandler } from './tip-handler'; @@ -106,7 +106,11 @@ export class TipItem extends Component { render() { const tip: IPublicTypeTipConfig = tipHandler.tip || ({} as any); - const className = classNames('lc-tip', tip.className, tip && tip.theme ? `lc-theme-${tip.theme}` : null); + const className = classNames( + 'lc-tip', + tip.className, + tip && tip.theme ? `lc-theme-${tip.theme}` : null, + ); this.originClassName = className; diff --git a/packages/editor-core/src/widgets/tip/tip.tsx b/packages/editor-core/src/widgets/tip/tip.tsx index 92a683baa5..6f56bf468e 100644 --- a/packages/editor-core/src/widgets/tip/tip.tsx +++ b/packages/editor-core/src/widgets/tip/tip.tsx @@ -1,6 +1,6 @@ import { Component } from 'react'; -import { IPublicTypeTipConfig } from '@alilc/lowcode-types'; -import { uniqueId } from '@alilc/lowcode-utils'; +import { IPublicTypeTipConfig } from '@felce/lowcode-types'; +import { uniqueId } from '@felce/lowcode-utils'; import { postTip } from './tip-handler'; export class Tip extends Component<IPublicTypeTipConfig> { diff --git a/packages/editor-core/src/widgets/title/index.tsx b/packages/editor-core/src/widgets/title/index.tsx index 7df2676f92..b974a99015 100644 --- a/packages/editor-core/src/widgets/title/index.tsx +++ b/packages/editor-core/src/widgets/title/index.tsx @@ -1,7 +1,11 @@ import { Component, isValidElement, ReactNode } from 'react'; import classNames from 'classnames'; -import { createIcon, isI18nData, isTitleConfig } from '@alilc/lowcode-utils'; -import { IPublicTypeI18nData, IPublicTypeTitleConfig, IPublicTypeTitleProps } from '@alilc/lowcode-types'; +import { createIcon, isI18nData, isTitleConfig } from '@felce/lowcode-utils'; +import { + IPublicTypeI18nData, + IPublicTypeTitleConfig, + IPublicTypeTitleProps, +} from '@felce/lowcode-types'; import { intl } from '../../intl'; import { Tip } from '../tip'; import './title.less'; @@ -13,7 +17,7 @@ import './title.less'; * @param keywords 关键字 * @returns 文字片段列表 */ - function splitLabelByKeywords(label: string, keywords: string): string[] { +function splitLabelByKeywords(label: string, keywords: string): string[] { const len = keywords.length; const fragments = []; let str = label; @@ -72,12 +76,12 @@ export class Title extends Component<IPublicTypeTitleProps> { if (match && keywords) { const fragments = splitLabelByKeywords(intlLabel as string, keywords); - labelToRender = fragments.map(f => <span style={{ color: f === keywords ? 'red' : 'inherit' }}>{f}</span>); + labelToRender = fragments.map((f) => ( + <span style={{ color: f === keywords ? 'red' : 'inherit' }}>{f}</span> + )); } - return ( - <span className="lc-title-txt">{labelToRender}</span> - ); + return <span className="lc-title-txt">{labelToRender}</span>; }; render() { diff --git a/packages/editor-skeleton/jest.config.js b/packages/editor-skeleton/jest.config.js index 8a9b2000ca..549f78af2e 100644 --- a/packages/editor-skeleton/jest.config.js +++ b/packages/editor-skeleton/jest.config.js @@ -1,7 +1,7 @@ const fs = require('fs'); const { join } = require('path'); const esModules = [].join('|'); -const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.')); +const pkgNames = fs.readdirSync(join('..')).filter((pkgName) => !pkgName.startsWith('.')); const jestConfig = { // transform: { @@ -9,21 +9,14 @@ const jestConfig = { // // '^.+\\.(ts|tsx)$': 'ts-jest', // // '^.+\\.(js|jsx)$': 'babel-jest', // }, - transformIgnorePatterns: [ - `/node_modules/(?!${esModules})/`, - ], + transformIgnorePatterns: [`/node_modules/(?!${esModules})/`], moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], collectCoverage: false, - collectCoverageFrom: [ - 'src/**/*.ts', - '!src/**/*.d.ts', - '!**/node_modules/**', - '!**/vendor/**', - ], + collectCoverageFrom: ['src/**/*.ts', '!src/**/*.d.ts', '!**/node_modules/**', '!**/vendor/**'], }; // 只对本仓库内的 pkg 做 mapping jestConfig.moduleNameMapper = {}; -jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; +jestConfig.moduleNameMapper[`^@felce/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; -module.exports = jestConfig; \ No newline at end of file +module.exports = jestConfig; diff --git a/packages/editor-skeleton/package.json b/packages/editor-skeleton/package.json index 63aab7e48b..7840e73ba7 100644 --- a/packages/editor-skeleton/package.json +++ b/packages/editor-skeleton/package.json @@ -1,6 +1,6 @@ { - "name": "@alilc/lowcode-editor-skeleton", - "version": "1.3.2", + "name": "@felce/lowcode-editor-skeleton", + "version": "1.4.0", "description": "alibaba lowcode editor skeleton", "main": "lib/index.js", "module": "es/index.js", @@ -18,11 +18,11 @@ "editor" ], "dependencies": { - "@alifd/next": "^1.20.12", - "@alilc/lowcode-designer": "1.3.2", - "@alilc/lowcode-editor-core": "1.3.2", - "@alilc/lowcode-types": "1.3.2", - "@alilc/lowcode-utils": "1.3.2", + "@alifd/next": "^1.26.0", + "@felce/lowcode-designer": "1.4.0", + "@felce/lowcode-editor-core": "1.4.0", + "@felce/lowcode-types": "1.4.0", + "@felce/lowcode-utils": "1.4.0", "classnames": "^2.2.6", "react": "^16.8.1", "react-dom": "^16.8.1" @@ -40,9 +40,9 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-skeleton" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/packages/editor-skeleton" }, "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/packages/editor-skeleton/src/area.ts b/packages/editor-skeleton/src/area.ts index 8dc711084b..c0ad92c894 100644 --- a/packages/editor-skeleton/src/area.ts +++ b/packages/editor-skeleton/src/area.ts @@ -1,7 +1,7 @@ /* eslint-disable max-len */ -import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core'; -import { Logger } from '@alilc/lowcode-utils'; -import { IPublicTypeWidgetBaseConfig } from '@alilc/lowcode-types'; +import { obx, computed, makeObservable } from '@felce/lowcode-editor-core'; +import { Logger } from '@felce/lowcode-utils'; +import { IPublicTypeWidgetBaseConfig } from '@felce/lowcode-types'; import { WidgetContainer } from './widget/widget-container'; import { ISkeleton } from './skeleton'; import { IWidget } from './widget/widget'; @@ -16,7 +16,9 @@ export interface IArea<C, T> { show(): void; } -export class Area<C extends IPublicTypeWidgetBaseConfig = any, T extends IWidget = IWidget> implements IArea<C, T> { +export class Area<C extends IPublicTypeWidgetBaseConfig = any, T extends IWidget = IWidget> + implements IArea<C, T> +{ @obx private _visible = true; @computed get visible() { @@ -37,9 +39,21 @@ export class Area<C extends IPublicTypeWidgetBaseConfig = any, T extends IWidget private lastCurrent: T | null = null; - constructor(readonly skeleton: ISkeleton, readonly name: string, handle: (item: T | C) => T, private exclusive?: boolean, defaultSetCurrent = false) { + constructor( + readonly skeleton: ISkeleton, + readonly name: string, + handle: (item: T | C) => T, + private exclusive?: boolean, + defaultSetCurrent = false, + ) { makeObservable(this); - this.container = skeleton.createContainer(name, handle, exclusive, () => this.visible, defaultSetCurrent); + this.container = skeleton.createContainer( + name, + handle, + exclusive, + () => this.visible, + defaultSetCurrent, + ); } isEmpty(): boolean { diff --git a/packages/editor-skeleton/src/components/field/fields.tsx b/packages/editor-skeleton/src/components/field/fields.tsx index 21ae93eb25..94b3a7ddd7 100644 --- a/packages/editor-skeleton/src/components/field/fields.tsx +++ b/packages/editor-skeleton/src/components/field/fields.tsx @@ -3,13 +3,13 @@ import { Component, ErrorInfo, MouseEvent } from 'react'; import { isObject } from 'lodash'; import classNames from 'classnames'; import { Icon } from '@alifd/next'; -import { Title } from '@alilc/lowcode-editor-core'; -import { IPublicModelEditor, IPublicTypeTitleContent } from '@alilc/lowcode-types'; +import { Title } from '@felce/lowcode-editor-core'; +import { IPublicModelEditor, IPublicTypeTitleContent } from '@felce/lowcode-types'; import { PopupPipe, PopupContext } from '../popup'; import './index.less'; import InlineTip from './inlinetip'; import { intl } from '../../locale'; -import { Logger } from '@alilc/lowcode-utils'; +import { Logger } from '@felce/lowcode-utils'; const logger = new Logger({ level: 'warn', bizName: 'skeleton:field' }); @@ -116,22 +116,37 @@ export class Field extends Component<FieldProps> { getTipContent(propName: string, tip?: any): any { let tipContent = ( <div> - <div>{intl('Attribute: ')}{propName}</div> + <div> + {intl('Attribute: ')} + {propName} + </div> </div> ); if (isObject(tip)) { tipContent = ( <div> - <div>{intl('Attribute: ')}{propName}</div> - <div>{intl('Description: ')}{(tip as any).content}</div> + <div> + {intl('Attribute: ')} + {propName} + </div> + <div> + {intl('Description: ')} + {(tip as any).content} + </div> </div> ); } else if (tip) { tipContent = ( <div> - <div>{intl('Attribute: ')}{propName}</div> - <div>{intl('Description: ')}{tip}</div> + <div> + {intl('Attribute: ')} + {propName} + </div> + <div> + {intl('Description: ')} + {tip} + </div> </div> ); } @@ -167,22 +182,23 @@ export class Field extends Component<FieldProps> { })} id={id} > - { - display !== 'plain' && ( - <div className="lc-field-head" onClick={isAccordion ? this.toggleExpand : undefined}> - <div className="lc-field-title"> - {createValueState(valueState, this.handleClear)} - <Title - title={title || ''} - onClick={this.clickHandler} - /> - <InlineTip position="top">{tipContent}</InlineTip> - </div> - {isAccordion && <Icon className="lc-field-icon" type="arrow-up" size="xs" />} + {display !== 'plain' && ( + <div className="lc-field-head" onClick={isAccordion ? this.toggleExpand : undefined}> + <div className="lc-field-title"> + {createValueState(valueState, this.handleClear)} + <Title title={title || ''} onClick={this.clickHandler} /> + <InlineTip position="top">{tipContent}</InlineTip> </div> - ) - } - <div key="body" ref={(shell) => { this.body = shell; }} className="lc-field-body"> + {isAccordion && <Icon className="lc-field-icon" type="arrow-up" size="xs" />} + </div> + )} + <div + key="body" + ref={(shell) => { + this.body = shell; + }} + className="lc-field-body" + > {children} </div> </div> diff --git a/packages/editor-skeleton/src/components/field/index.ts b/packages/editor-skeleton/src/components/field/index.ts index defe151cf7..b81dfd2c9d 100644 --- a/packages/editor-skeleton/src/components/field/index.ts +++ b/packages/editor-skeleton/src/components/field/index.ts @@ -1,5 +1,5 @@ import { ReactNode, createElement } from 'react'; -import { IPublicTypeTitleContent } from '@alilc/lowcode-types'; +import { IPublicTypeTitleContent } from '@felce/lowcode-types'; import './index.less'; import { Field, PopupField, EntryField, PlainField } from './fields'; @@ -14,7 +14,11 @@ export interface FieldProps { [extra: string]: any; } -export function createField(props: FieldProps, children: ReactNode, type?: 'accordion' | 'inline' | 'block' | 'plain' | 'popup' | 'entry'): ReactNode { +export function createField( + props: FieldProps, + children: ReactNode, + type?: 'accordion' | 'inline' | 'block' | 'plain' | 'popup' | 'entry', +): ReactNode { if (type === 'popup') { return createElement(PopupField, props, children); } diff --git a/packages/editor-skeleton/src/components/popup/index.tsx b/packages/editor-skeleton/src/components/popup/index.tsx index 1367723a16..3ba3c5237b 100644 --- a/packages/editor-skeleton/src/components/popup/index.tsx +++ b/packages/editor-skeleton/src/components/popup/index.tsx @@ -1,25 +1,24 @@ import { createContext, ReactNode, Component, PureComponent } from 'react'; import { Drawer, ConfigProvider } from '@alifd/next'; -import { uniqueId } from '@alilc/lowcode-utils'; -import { IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core'; +import { uniqueId } from '@felce/lowcode-utils'; +import { IEventBus, createModuleEventBus } from '@felce/lowcode-editor-core'; import './style.less'; export interface PopupExtProps { width?: number; hasMask?: boolean; trigger?: ReactNode; - canCloseByOutSideClick?: boolean + canCloseByOutSideClick?: boolean; className?: string; safeNode?: string[]; } -interface PopupProps extends PopupExtProps{ - content?: ReactNode, - title?: ReactNode, - actionKey?: string +interface PopupProps extends PopupExtProps { + content?: ReactNode; + title?: ReactNode; + actionKey?: string; } - export const PopupContext = createContext<PopupPipe>({} as any); export class PopupPipe { @@ -103,9 +102,9 @@ export default class PopupService extends Component<{ } interface StateType extends PopupProps { - visible?: boolean, - offsetX?: number, - pos?: {top: number, height: number} + visible?: boolean; + offsetX?: number; + pos?: { top: number; height: number }; } export class PopupContent extends PureComponent<{ safeId?: string; popupContainer?: string }> { static contextType = PopupContext; @@ -153,7 +152,18 @@ export class PopupContent extends PureComponent<{ safeId?: string; popupContaine }; render() { - const { content, visible, title, actionKey, pos, offsetX, width = 360, hasMask = false, canCloseByOutSideClick = true, safeNode = [] } = this.state; + const { + content, + visible, + title, + actionKey, + pos, + offsetX, + width = 360, + hasMask = false, + canCloseByOutSideClick = true, + safeNode = [], + } = this.state; if (!visible) { return null; } @@ -192,9 +202,7 @@ export class PopupContent extends PureComponent<{ safeId?: string; popupContaine <div className="lc-ballon-title">{title}</div> <div className="lc-ballon-content"> <PopupService actionKey={actionKey} safeId={id} popupContainer={this.popupContainerId}> - <ConfigProvider popupContainer={this.popupContainerId}> - {content} - </ConfigProvider> + <ConfigProvider popupContainer={this.popupContainerId}>{content}</ConfigProvider> </PopupService> </div> <div id={this.popupContainerId} /> diff --git a/packages/editor-skeleton/src/components/settings/main.ts b/packages/editor-skeleton/src/components/settings/main.ts index 6cc672c907..34bfc6b232 100644 --- a/packages/editor-skeleton/src/components/settings/main.ts +++ b/packages/editor-skeleton/src/components/settings/main.ts @@ -1,5 +1,13 @@ -import { Node, Designer, Selection, SettingTopEntry } from '@alilc/lowcode-designer'; -import { Editor, obx, computed, makeObservable, action, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core'; +import { Node, Designer, Selection, SettingTopEntry } from '@felce/lowcode-designer'; +import { + Editor, + obx, + computed, + makeObservable, + action, + IEventBus, + createModuleEventBus, +} from '@felce/lowcode-editor-core'; function generateSessionId(nodes: Node[]) { return nodes diff --git a/packages/editor-skeleton/src/components/settings/settings-pane.tsx b/packages/editor-skeleton/src/components/settings/settings-pane.tsx index 1561bf8bbe..94af9429d3 100644 --- a/packages/editor-skeleton/src/components/settings/settings-pane.tsx +++ b/packages/editor-skeleton/src/components/settings/settings-pane.tsx @@ -1,9 +1,24 @@ import { Component, MouseEvent, Fragment, ReactNode } from 'react'; -import { shallowIntl, observer, obx, engineConfig, runInAction } from '@alilc/lowcode-editor-core'; -import { createContent, isJSSlot, isSetterConfig, shouldUseVariableSetter } from '@alilc/lowcode-utils'; -import { Skeleton, Stage } from '@alilc/lowcode-editor-skeleton'; -import { IPublicApiSetters, IPublicTypeCustomView, IPublicTypeDynamicProps } from '@alilc/lowcode-types'; -import { ISettingEntry, IComponentMeta, ISettingField, isSettingField, ISettingTopEntry } from '@alilc/lowcode-designer'; +import { shallowIntl, observer, obx, engineConfig, runInAction } from '@felce/lowcode-editor-core'; +import { + createContent, + isJSSlot, + isSetterConfig, + shouldUseVariableSetter, +} from '@felce/lowcode-utils'; +import { Skeleton, Stage } from '@felce/lowcode-editor-skeleton'; +import { + IPublicApiSetters, + IPublicTypeCustomView, + IPublicTypeDynamicProps, +} from '@felce/lowcode-types'; +import { + ISettingEntry, + IComponentMeta, + ISettingField, + isSettingField, + ISettingTopEntry, +} from '@felce/lowcode-designer'; import { createField } from '../field'; import PopupService, { PopupPipe } from '../popup'; import { SkeletonContext } from '../../context'; @@ -25,9 +40,13 @@ function isStandardComponent(componentMeta: IComponentMeta | null) { function isInitialValueNotEmpty(initialValue: any) { if (isJSSlot(initialValue)) { // @ts-ignore visible 为 false 代表默认不展示 - return initialValue.visible !== false && Array.isArray(initialValue.value) && initialValue.value.length > 0; + return ( + initialValue.visible !== false && + Array.isArray(initialValue.value) && + initialValue.value.length > 0 + ); } - return (initialValue !== undefined && initialValue !== null); + return initialValue !== undefined && initialValue !== null; } type SettingFieldViewProps = { field: ISettingField }; @@ -61,7 +80,11 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView stages.add({ type: 'Widget', name: stageName, - content: <Fragment>{field.items.map((item, index) => createSettingFieldView(item, field, index))}</Fragment>, + content: ( + <Fragment> + {field.items.map((item, index) => createSettingFieldView(item, field, index))} + </Fragment> + ), props: { title: field.title, }, @@ -79,7 +102,9 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView const { extraProps } = this.field; const { condition } = extraProps; try { - return typeof condition === 'function' ? condition(this.field.internalToShellField()) !== false : true; + return typeof condition === 'function' + ? condition(this.field.internalToShellField()) !== false + : true; } catch (error) { console.error('exception when condition (hidden) is excuted', error); } @@ -111,9 +136,11 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView const { defaultValue } = extraProps; const { setter } = this.field; - let setterProps: { - setters?: (ReactNode | string)[]; - } & Record<string, unknown> | IPublicTypeDynamicProps = {}; + let setterProps: + | ({ + setters?: (ReactNode | string)[]; + } & Record<string, unknown>) + | IPublicTypeDynamicProps = {}; let setterType: any; let initialValue: any = null; @@ -154,7 +181,8 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView // 根据是否支持变量配置做相应的更改 const supportVariable = this.field.extraProps?.supportVariable; // supportVariableGlobally 只对标准组件生效,vc 需要单独配置 - const supportVariableGlobally = engineConfig.get('supportVariableGlobally', false) && isStandardComponent(componentMeta); + const supportVariableGlobally = + engineConfig.get('supportVariableGlobally', false) && isStandardComponent(componentMeta); const isUseVariableSetter = shouldUseVariableSetter(supportVariable, supportVariableGlobally); if (isUseVariableSetter === false) { return { @@ -172,10 +200,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView } else { setterType = 'MixedSetter'; setterProps = { - setters: [ - setter, - 'VariableSetter', - ], + setters: [setter, 'VariableSetter'], }; } return { @@ -191,7 +216,8 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView initDefaultValue() { const { initialValue } = this.setterInfo; - if (this.state?.fromOnChange || + if ( + this.state?.fromOnChange || !isInitialValueNotEmpty(initialValue) || this.ignoreDefaultValue || this.value !== undefined @@ -200,7 +226,10 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView } // 当前 field 没有 value 值时,将 initialValue 写入 field // 之所以用 initialValue,而不是 defaultValue 是为了保持跟 props.onInitial 的逻辑一致 - const _initialValue = typeof initialValue === 'function' ? initialValue(this.field.internalToShellField()) : initialValue; + const _initialValue = + typeof initialValue === 'function' + ? initialValue(this.field.internalToShellField()) + : initialValue; this.field.setValue(_initialValue); } @@ -217,11 +246,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView return null; } - const { - setterProps = {}, - setterType, - initialValue = null, - } = this.setterInfo; + const { setterProps = {}, setterType, initialValue = null } = this.setterInfo; const value = this.value; @@ -243,44 +268,47 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView ...extraProps, }, !stageName && - this.setters?.createSetterContent(setterType, { - ...shallowIntl(setterProps), - forceInline: extraProps.forceInline, - key: field.id, - // === injection - prop: field.internalToShellField(), // for compatible vision - selected: field.top?.getNode()?.internalToShellNode(), - field: field.internalToShellField(), - // === IO - value, // reaction point - initialValue, - onChange: (value: any) => { - this.setState({ - fromOnChange: true, - // eslint-disable-next-line react/no-unused-state - value, - }); - field.setValue(value, true); - if (onChangeAPI) onChangeAPI(value, field.internalToShellField()); - }, - onInitial: () => { - if (initialValue == null) { - return; - } - const value = typeof initialValue === 'function' ? initialValue(field.internalToShellField()) : initialValue; - this.setState({ - // eslint-disable-next-line react/no-unused-state - value, - }); - field.setValue(value, true); - }, - - removeProp: () => { - if (field.name) { - field.parent.clearPropValue(field.name); - } - }, - }), + this.setters?.createSetterContent(setterType, { + ...shallowIntl(setterProps), + forceInline: extraProps.forceInline, + key: field.id, + // === injection + prop: field.internalToShellField(), // for compatible vision + selected: field.top?.getNode()?.internalToShellNode(), + field: field.internalToShellField(), + // === IO + value, // reaction point + initialValue, + onChange: (value: any) => { + this.setState({ + fromOnChange: true, + // eslint-disable-next-line react/no-unused-state + value, + }); + field.setValue(value, true); + if (onChangeAPI) onChangeAPI(value, field.internalToShellField()); + }, + onInitial: () => { + if (initialValue == null) { + return; + } + const value = + typeof initialValue === 'function' + ? initialValue(field.internalToShellField()) + : initialValue; + this.setState({ + // eslint-disable-next-line react/no-unused-state + value, + }); + field.setValue(value, true); + }, + + removeProp: () => { + if (field.name) { + field.parent.clearPropValue(field.name); + } + }, + }), extraProps.forceInline ? 'plain' : extraProps.display, ); } @@ -311,7 +339,11 @@ class SettingGroupView extends Component<SettingGroupViewProps> { stages.add({ type: 'Widget', name: stageName, - content: <Fragment>{field.items.map((item, index) => createSettingFieldView(item, field, index))}</Fragment>, + content: ( + <Fragment> + {field.items.map((item, index) => createSettingFieldView(item, field, index))} + </Fragment> + ), props: { title: field.title, }, @@ -325,7 +357,10 @@ class SettingGroupView extends Component<SettingGroupViewProps> { const { field } = this.props; const { extraProps } = field; const { condition, display } = extraProps; - const visible = field.isSingle && typeof condition === 'function' ? condition(field.internalToShellField()) !== false : true; + const visible = + field.isSingle && typeof condition === 'function' + ? condition(field.internalToShellField()) !== false + : true; if (!visible) { return null; @@ -349,7 +384,11 @@ class SettingGroupView extends Component<SettingGroupViewProps> { } } -export function createSettingFieldView(field: ISettingField | IPublicTypeCustomView, fieldEntry: ISettingEntry, index?: number) { +export function createSettingFieldView( + field: ISettingField | IPublicTypeCustomView, + fieldEntry: ISettingEntry, + index?: number, +) { if (isSettingField(field)) { if (field.isGroup) { return <SettingGroupView field={field} key={field.id} />; diff --git a/packages/editor-skeleton/src/components/settings/settings-primary-pane.tsx b/packages/editor-skeleton/src/components/settings/settings-primary-pane.tsx index 747a2ea1df..d5174a8a4c 100644 --- a/packages/editor-skeleton/src/components/settings/settings-primary-pane.tsx +++ b/packages/editor-skeleton/src/components/settings/settings-primary-pane.tsx @@ -1,14 +1,22 @@ import React, { Component } from 'react'; import { Tab, Breadcrumb } from '@alifd/next'; -import { Title, observer, Editor, obx, globalContext, engineConfig, makeObservable } from '@alilc/lowcode-editor-core'; -import { Node, SettingField, isSettingField, INode } from '@alilc/lowcode-designer'; +import { + Title, + observer, + Editor, + obx, + globalContext, + engineConfig, + makeObservable, +} from '@felce/lowcode-editor-core'; +import { Node, SettingField, isSettingField, INode } from '@felce/lowcode-designer'; import classNames from 'classnames'; import { SettingsMain } from './main'; import { SettingsPane } from './settings-pane'; import { StageBox } from '../stage-box'; import { SkeletonContext } from '../../context'; import { intl } from '../../locale'; -import { createIcon } from '@alilc/lowcode-utils'; +import { createIcon } from '@felce/lowcode-utils'; interface ISettingsPrimaryPaneProps { engineEditor: Editor; @@ -16,7 +24,10 @@ interface ISettingsPrimaryPaneProps { } @observer -export class SettingsPrimaryPane extends Component<ISettingsPrimaryPaneProps, { shouldIgnoreRoot: boolean }> { +export class SettingsPrimaryPane extends Component< + ISettingsPrimaryPaneProps, + { shouldIgnoreRoot: boolean } +> { state = { shouldIgnoreRoot: false, }; @@ -93,27 +104,29 @@ export class SettingsPrimaryPane extends Component<ISettingsPrimaryPaneProps, { l === 2 ? {} : { - onMouseOver: hoverNode.bind(null, _node, true), - onMouseOut: hoverNode.bind(null, _node, false), - onClick: () => { - if (!_node) { - return; - } - selectNode.call(null, _node); - const getName = (node: any) => { - const npm = node?.componentMeta?.npm; - return [npm?.package, npm?.componentName].filter((item) => !!item).join('-') || - node?.componentMeta?.componentName || - ''; - }; - const selected = getName(current); - const target = getName(_node); - editor?.eventBus.emit('skeleton.settingsPane.Breadcrumb', { - selected, - target, - }); - }, - }; + onMouseOver: hoverNode.bind(null, _node, true), + onMouseOut: hoverNode.bind(null, _node, false), + onClick: () => { + if (!_node) { + return; + } + selectNode.call(null, _node); + const getName = (node: any) => { + const npm = node?.componentMeta?.npm; + return ( + [npm?.package, npm?.componentName].filter((item) => !!item).join('-') || + node?.componentMeta?.componentName || + '' + ); + }; + const selected = getName(current); + const target = getName(_node); + editor?.eventBus.emit('skeleton.settingsPane.Breadcrumb', { + selected, + target, + }); + }, + }; items.unshift( <Breadcrumb.Item {...props} key={node.id}> <Title title={node.title} /> @@ -211,14 +224,12 @@ export class SettingsPrimaryPane extends Component<ISettingsPrimaryPaneProps, { className="lc-settings-tab-item" title={<Title title={field.title} />} key={field.name} - onClick={ - () => { - editor?.eventBus.emit('skeleton.settingsPane.change', { - name: field.name, - title: field.title, - }); - } - } + onClick={() => { + editor?.eventBus.emit('skeleton.settingsPane.change', { + name: field.name, + title: field.title, + }); + }} > <SkeletonContext.Consumer> {(skeleton) => { @@ -243,7 +254,7 @@ export class SettingsPrimaryPane extends Component<ISettingsPrimaryPaneProps, { }); return ( <div className={className}> - { this.renderBreadcrumb() } + {this.renderBreadcrumb()} <Tab activeKey={activeKey} onChange={(tabKey) => { diff --git a/packages/editor-skeleton/src/components/stage-box/stage-box.tsx b/packages/editor-skeleton/src/components/stage-box/stage-box.tsx index 5015853824..7d25857735 100644 --- a/packages/editor-skeleton/src/components/stage-box/stage-box.tsx +++ b/packages/editor-skeleton/src/components/stage-box/stage-box.tsx @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import classNames from 'classnames'; -import { observer } from '@alilc/lowcode-editor-core'; +import { observer } from '@felce/lowcode-editor-core'; import StageChain from './stage-chain'; import Stage from './stage'; import { ISkeleton } from '../../skeleton'; @@ -104,8 +104,12 @@ export default class StageBox extends Component<StageBoxProps> { let contentRefer = null; if (refer) { - contentCurrent = <Stage key={stage.getId()} stage={stage} direction={refer.direction} current />; - contentRefer = <Stage key={refer?.stage?.getId()} stage={refer?.stage} direction={refer.direction} />; + contentCurrent = ( + <Stage key={stage.getId()} stage={stage} direction={refer.direction} current /> + ); + contentRefer = ( + <Stage key={refer?.stage?.getId()} stage={refer?.stage} direction={refer.direction} /> + ); } else { contentCurrent = <Stage key={stage.getId()} stage={stage} current />; } @@ -117,12 +121,9 @@ export default class StageBox extends Component<StageBoxProps> { }} className={className} > - <PopupService popupPipe={this.popupPipe}> - {contentRefer} {contentCurrent} - </PopupService> </div> ); diff --git a/packages/editor-skeleton/src/components/stage-box/stage-chain.ts b/packages/editor-skeleton/src/components/stage-box/stage-chain.ts index fe931769fa..efa71f222b 100644 --- a/packages/editor-skeleton/src/components/stage-box/stage-chain.ts +++ b/packages/editor-skeleton/src/components/stage-box/stage-chain.ts @@ -1,5 +1,5 @@ import { Stage as StageWidget } from '../../widget/stage'; -import { createModuleEventBus, IEventBus } from '@alilc/lowcode-editor-core'; +import { createModuleEventBus, IEventBus } from '@felce/lowcode-editor-core'; export default class StageChain { private emitter: IEventBus; diff --git a/packages/editor-skeleton/src/components/stage-box/stage.tsx b/packages/editor-skeleton/src/components/stage-box/stage.tsx index e4b0c0ef12..65dbb33ae8 100644 --- a/packages/editor-skeleton/src/components/stage-box/stage.tsx +++ b/packages/editor-skeleton/src/components/stage-box/stage.tsx @@ -4,7 +4,7 @@ import classNames from 'classnames'; import { IconArrow } from '../../icons/arrow'; import { IconExit } from '../../icons/exit'; import { Stage as StageWidget } from '../../widget/stage'; -import { isTitleConfig } from '@alilc/lowcode-utils'; +import { isTitleConfig } from '@felce/lowcode-utils'; export const StageDefaultProps = { current: false, @@ -78,9 +78,17 @@ export default class Stage extends Component<StageProps> { const stageBacker = stage?.hasBack() ? ( <div className="skeleton-stagebox-stagebacker"> - <IconArrow className="skeleton-stagebox-stage-arrow" size="medium" data-stage-target="stageback" /> + <IconArrow + className="skeleton-stagebox-stage-arrow" + size="medium" + data-stage-target="stageback" + /> <span className="skeleton-stagebox-stage-title">{newTitle}</span> - <IconExit className="skeleton-stagebox-stage-exit" size="medium" data-stage-target="stageexit" /> + <IconExit + className="skeleton-stagebox-stage-exit" + size="medium" + data-stage-target="stageexit" + /> </div> ) : null; diff --git a/packages/editor-skeleton/src/components/widget-views/index.tsx b/packages/editor-skeleton/src/components/widget-views/index.tsx index 7cdff4c014..b06854f223 100644 --- a/packages/editor-skeleton/src/components/widget-views/index.tsx +++ b/packages/editor-skeleton/src/components/widget-views/index.tsx @@ -1,6 +1,6 @@ import { Component, ReactElement } from 'react'; import classNames from 'classnames'; -import { Title, observer, HelpTip } from '@alilc/lowcode-editor-core'; +import { Title, observer, HelpTip } from '@felce/lowcode-editor-core'; import { DockProps } from '../../types'; import { PanelDock } from '../../widget/panel-dock'; import { composeTitle } from '../../widget/utils'; @@ -257,7 +257,14 @@ export class TabsPanelView extends Component<{ const contents: ReactElement[] = []; // 如果只有一个标签且 shouldHideSingleTab 为 true,则不显示 Tabs if (this.props.shouldHideSingleTab && container.items.length === 1) { - contents.push(<PanelView key={container.items[0].id} panel={container.items[0]} hideOperationRow hideDragLine />); + contents.push( + <PanelView + key={container.items[0].id} + panel={container.items[0]} + hideOperationRow + hideDragLine + />, + ); } else { container.items.forEach((item: any) => { titles.push(<PanelTitle key={item.id} panel={item} className="lc-tab-title" />); diff --git a/packages/editor-skeleton/src/components/widget-views/panel-operation-row.tsx b/packages/editor-skeleton/src/components/widget-views/panel-operation-row.tsx index 605f4f5705..20e0ddbfae 100644 --- a/packages/editor-skeleton/src/components/widget-views/panel-operation-row.tsx +++ b/packages/editor-skeleton/src/components/widget-views/panel-operation-row.tsx @@ -1,6 +1,6 @@ import { Component, Fragment } from 'react'; import { Button, Icon } from '@alifd/next'; -import { action, makeObservable } from '@alilc/lowcode-editor-core'; +import { action, makeObservable } from '@felce/lowcode-editor-core'; import { IconFix } from '../../icons/fix'; import { IconFloat } from '../../icons/float'; import { Panel } from '../../widget/panel'; diff --git a/packages/editor-skeleton/src/icons/arrow.tsx b/packages/editor-skeleton/src/icons/arrow.tsx index 520a993232..05e1055d2e 100644 --- a/packages/editor-skeleton/src/icons/arrow.tsx +++ b/packages/editor-skeleton/src/icons/arrow.tsx @@ -1,5 +1,4 @@ - -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconArrow(props: IconProps) { return ( @@ -8,4 +7,4 @@ export function IconArrow(props: IconProps) { </SVGIcon> ); } -IconArrow.displayName = 'Arrow'; \ No newline at end of file +IconArrow.displayName = 'Arrow'; diff --git a/packages/editor-skeleton/src/icons/clear.tsx b/packages/editor-skeleton/src/icons/clear.tsx index ff4287e908..3b3ec90e95 100644 --- a/packages/editor-skeleton/src/icons/clear.tsx +++ b/packages/editor-skeleton/src/icons/clear.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconClear(props: IconProps) { return ( diff --git a/packages/editor-skeleton/src/icons/convert.tsx b/packages/editor-skeleton/src/icons/convert.tsx index 62a877d330..ed6220cc50 100644 --- a/packages/editor-skeleton/src/icons/convert.tsx +++ b/packages/editor-skeleton/src/icons/convert.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconConvert(props: IconProps) { return ( diff --git a/packages/editor-skeleton/src/icons/exit.tsx b/packages/editor-skeleton/src/icons/exit.tsx index bdcc9e513a..f1211125df 100644 --- a/packages/editor-skeleton/src/icons/exit.tsx +++ b/packages/editor-skeleton/src/icons/exit.tsx @@ -1,5 +1,4 @@ - -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconExit(props: IconProps) { return ( @@ -8,4 +7,4 @@ export function IconExit(props: IconProps) { </SVGIcon> ); } -IconExit.displayName = 'Exit'; \ No newline at end of file +IconExit.displayName = 'Exit'; diff --git a/packages/editor-skeleton/src/icons/fix.tsx b/packages/editor-skeleton/src/icons/fix.tsx index 6973c77b43..3d4fc77dde 100644 --- a/packages/editor-skeleton/src/icons/fix.tsx +++ b/packages/editor-skeleton/src/icons/fix.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconFix(props: IconProps) { const rect = { diff --git a/packages/editor-skeleton/src/icons/float.tsx b/packages/editor-skeleton/src/icons/float.tsx index afc42036a8..a657beb4e0 100644 --- a/packages/editor-skeleton/src/icons/float.tsx +++ b/packages/editor-skeleton/src/icons/float.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconFloat(props: IconProps) { return ( diff --git a/packages/editor-skeleton/src/icons/slot.tsx b/packages/editor-skeleton/src/icons/slot.tsx index de26099de1..4a70b94c71 100644 --- a/packages/editor-skeleton/src/icons/slot.tsx +++ b/packages/editor-skeleton/src/icons/slot.tsx @@ -1,9 +1,12 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconSlot(props: IconProps) { return ( <SVGIcon viewBox="0 0 1024 1024" {...props}> - <path d="M682.325333 135.509333V204.8H819.2v613.376h-614.741333V204.8h136.874666v-69.290667h-206.165333v752.298667h754.346667V135.509333z" c="Q29weXJpZ2h0IChjKSAyMDIwLXByZXNlbnQgQWxpYmFiYSBJbmMu" /> + <path + d="M682.325333 135.509333V204.8H819.2v613.376h-614.741333V204.8h136.874666v-69.290667h-206.165333v752.298667h754.346667V135.509333z" + c="Q29weXJpZ2h0IChjKSAyMDIwLXByZXNlbnQgQWxpYmFiYSBJbmMu" + /> <path d="M512 512m-170.325333 0a170.325333 170.325333 0 1 0 340.650666 0 170.325333 170.325333 0 1 0-340.650666 0Z" /> </SVGIcon> ); diff --git a/packages/editor-skeleton/src/icons/variable.tsx b/packages/editor-skeleton/src/icons/variable.tsx index ce2e7a2953..c53dd11129 100644 --- a/packages/editor-skeleton/src/icons/variable.tsx +++ b/packages/editor-skeleton/src/icons/variable.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconVariable(props: IconProps) { return ( diff --git a/packages/editor-skeleton/src/layouts/bottom-area.tsx b/packages/editor-skeleton/src/layouts/bottom-area.tsx index 2981cc5969..abb32d1961 100644 --- a/packages/editor-skeleton/src/layouts/bottom-area.tsx +++ b/packages/editor-skeleton/src/layouts/bottom-area.tsx @@ -1,6 +1,6 @@ import { Component, Fragment } from 'react'; import classNames from 'classnames'; -import { observer } from '@alilc/lowcode-editor-core'; +import { observer } from '@felce/lowcode-editor-core'; import { Area } from '../area'; import { Panel } from '../widget/panel'; @@ -12,9 +12,10 @@ export default class BottomArea extends Component<{ area: Area<any, Panel> }> { return null; } return ( - <div className={classNames('lc-bottom-area', { - 'lc-area-visible': area.visible, - })} + <div + className={classNames('lc-bottom-area', { + 'lc-area-visible': area.visible, + })} > <Contents area={area} /> </div> @@ -26,10 +27,6 @@ export default class BottomArea extends Component<{ area: Area<any, Panel> }> { class Contents extends Component<{ area: Area<any, Panel> }> { render() { const { area } = this.props; - return ( - <Fragment> - {area.container.items.map((item) => item.content)} - </Fragment> - ); + return <Fragment>{area.container.items.map((item) => item.content)}</Fragment>; } } diff --git a/packages/editor-skeleton/src/layouts/left-area.tsx b/packages/editor-skeleton/src/layouts/left-area.tsx index d30dcfa863..c7359e68f9 100644 --- a/packages/editor-skeleton/src/layouts/left-area.tsx +++ b/packages/editor-skeleton/src/layouts/left-area.tsx @@ -1,6 +1,6 @@ import { Component, Fragment } from 'react'; import classNames from 'classnames'; -import { observer } from '@alilc/lowcode-editor-core'; +import { observer } from '@felce/lowcode-editor-core'; import { Area } from '../area'; @observer @@ -11,9 +11,10 @@ export default class LeftArea extends Component<{ area: Area; className?: string return null; } return ( - <div className={classNames(className, { - 'lc-area-visible': area.visible, - })} + <div + className={classNames(className, { + 'lc-area-visible': area.visible, + })} > <Contents area={area} /> </div> @@ -27,18 +28,21 @@ class Contents extends Component<{ area: Area }> { const { area } = this.props; const top: any[] = []; const bottom: any[] = []; - area.container.items.slice().sort((a, b) => { - const index1 = a.config?.index || 0; - const index2 = b.config?.index || 0; - return index1 === index2 ? 0 : (index1 > index2 ? 1 : -1); - }).forEach((item) => { - const content = <div key={`left-area-${item.name}`}>{item.content}</div>; - if (item.align === 'bottom') { - bottom.push(content); - } else { - top.push(content); - } - }); + area.container.items + .slice() + .sort((a, b) => { + const index1 = a.config?.index || 0; + const index2 = b.config?.index || 0; + return index1 === index2 ? 0 : index1 > index2 ? 1 : -1; + }) + .forEach((item) => { + const content = <div key={`left-area-${item.name}`}>{item.content}</div>; + if (item.align === 'bottom') { + bottom.push(content); + } else { + top.push(content); + } + }); return ( <Fragment> <div className="lc-left-area-top">{top}</div> diff --git a/packages/editor-skeleton/src/layouts/left-fixed-pane.tsx b/packages/editor-skeleton/src/layouts/left-fixed-pane.tsx index a56b449079..a771c2c1f4 100644 --- a/packages/editor-skeleton/src/layouts/left-fixed-pane.tsx +++ b/packages/editor-skeleton/src/layouts/left-fixed-pane.tsx @@ -1,12 +1,14 @@ import { Component, Fragment } from 'react'; import classNames from 'classnames'; -import { observer } from '@alilc/lowcode-editor-core'; +import { observer } from '@felce/lowcode-editor-core'; import { Area } from '../area'; import { Panel } from '../widget/panel'; -import { IPublicTypePanelConfig } from '@alilc/lowcode-types'; +import { IPublicTypePanelConfig } from '@felce/lowcode-types'; @observer -export default class LeftFixedPane extends Component<{ area: Area<IPublicTypePanelConfig, Panel> }> { +export default class LeftFixedPane extends Component<{ + area: Area<IPublicTypePanelConfig, Panel>; +}> { componentDidUpdate() { // FIXME: dirty fix, need deep think this.props.area.skeleton.editor.get('designer')?.touchOffsetObserver(); @@ -17,8 +19,8 @@ export default class LeftFixedPane extends Component<{ area: Area<IPublicTypePan const width = area.current?.config.props?.width; const style = width ? { - width, - } + width, + } : undefined; return ( diff --git a/packages/editor-skeleton/src/layouts/left-float-pane.tsx b/packages/editor-skeleton/src/layouts/left-float-pane.tsx index 296f083211..896bdf91c9 100644 --- a/packages/editor-skeleton/src/layouts/left-float-pane.tsx +++ b/packages/editor-skeleton/src/layouts/left-float-pane.tsx @@ -1,12 +1,14 @@ import { Component, Fragment } from 'react'; import classNames from 'classnames'; -import { observer, Focusable } from '@alilc/lowcode-editor-core'; +import { observer, Focusable } from '@felce/lowcode-editor-core'; import { Area } from '../area'; import { Panel } from '../widget/panel'; -import { IPublicApiProject, IPublicTypePanelConfig } from '@alilc/lowcode-types'; +import { IPublicApiProject, IPublicTypePanelConfig } from '@felce/lowcode-types'; @observer -export default class LeftFloatPane extends Component<{ area: Area<IPublicTypePanelConfig, Panel> }> { +export default class LeftFloatPane extends Component<{ + area: Area<IPublicTypePanelConfig, Panel>; +}> { private dispose?: () => void; private focusing?: Focusable; @@ -21,7 +23,9 @@ export default class LeftFloatPane extends Component<{ area: Area<IPublicTypePan if (e.originalEvent?.target?.classList.contains('insertion')) return; // 假如当前操作 target 祖先节点中有属性 data-keep-visible-while-dragging="true" 代表该 target 所属 panel // 不希望 target 在 panel 范围内拖拽时关闭 panel - const panelElem = e.originalEvent?.target.closest('div[data-keep-visible-while-dragging="true"]'); + const panelElem = e.originalEvent?.target.closest( + 'div[data-keep-visible-while-dragging="true"]', + ); if (panelElem) return; area.setVisible(false); }; @@ -43,7 +47,11 @@ export default class LeftFloatPane extends Component<{ area: Area<IPublicTypePan return true; } // 点击了 iframe 内容,算失焦 - if ((document.querySelector('.lc-simulator-content-frame') as HTMLIFrameElement)?.contentWindow?.document.documentElement.contains(target)) { + if ( + ( + document.querySelector('.lc-simulator-content-frame') as HTMLIFrameElement + )?.contentWindow?.document.documentElement.contains(target) + ) { return false; } if (project?.simulatorHost?.contentWindow?.document.documentElement.contains(target)) { @@ -63,7 +71,7 @@ export default class LeftFloatPane extends Component<{ area: Area<IPublicTypePan } const docks = area.current?.getAssocDocks(); if (docks && docks?.length) { - return docks.some(dock => dock.getDOMNode()?.contains(target)); + return docks.some((dock) => dock.getDOMNode()?.contains(target)); } return false; }, @@ -107,12 +115,16 @@ export default class LeftFloatPane extends Component<{ area: Area<IPublicTypePan const { area } = this.props; const width = area.current?.config.props?.width; - const style = width ? { - width, - } : undefined; + const style = width + ? { + width, + } + : undefined; return ( <div - ref={(ref) => { this.shell = ref; }} + ref={(ref) => { + this.shell = ref; + }} className={classNames('lc-left-float-pane', { 'lc-area-visible': area.visible, })} @@ -128,10 +140,6 @@ export default class LeftFloatPane extends Component<{ area: Area<IPublicTypePan class Contents extends Component<{ area: Area<any, Panel> }> { render() { const { area } = this.props; - return ( - <Fragment> - {area.container.items.map((panel) => panel.content)} - </Fragment> - ); + return <Fragment>{area.container.items.map((panel) => panel.content)}</Fragment>; } } diff --git a/packages/editor-skeleton/src/layouts/main-area.tsx b/packages/editor-skeleton/src/layouts/main-area.tsx index 400d337952..87a8bdda1e 100644 --- a/packages/editor-skeleton/src/layouts/main-area.tsx +++ b/packages/editor-skeleton/src/layouts/main-area.tsx @@ -1,6 +1,6 @@ import { Component } from 'react'; import classNames from 'classnames'; -import { observer } from '@alilc/lowcode-editor-core'; +import { observer } from '@felce/lowcode-editor-core'; import { Area } from '../area'; import { Panel } from '../widget/panel'; import { Widget } from '../widget/widget'; diff --git a/packages/editor-skeleton/src/layouts/right-area.tsx b/packages/editor-skeleton/src/layouts/right-area.tsx index f00ae1461a..c8d7592a3c 100644 --- a/packages/editor-skeleton/src/layouts/right-area.tsx +++ b/packages/editor-skeleton/src/layouts/right-area.tsx @@ -1,6 +1,6 @@ import { Component, Fragment } from 'react'; import classNames from 'classnames'; -import { observer } from '@alilc/lowcode-editor-core'; +import { observer } from '@felce/lowcode-editor-core'; import { Area } from '../area'; import { Panel } from '../widget/panel'; @@ -12,9 +12,10 @@ export default class RightArea extends Component<{ area: Area<any, Panel> }> { return null; } return ( - <div className={classNames('lc-right-area engine-tabpane', { - 'lc-area-visible': area.visible, - })} + <div + className={classNames('lc-right-area engine-tabpane', { + 'lc-area-visible': area.visible, + })} > <Contents area={area} /> </div> @@ -29,16 +30,14 @@ class Contents extends Component<{ area: Area<any, Panel> }> { return ( <Fragment> - { - area.container.items - .slice() - .sort((a, b) => { - const index1 = a.config?.index || 0; - const index2 = b.config?.index || 0; - return index1 === index2 ? 0 : (index1 > index2 ? 1 : -1); - }) - .map((item) => item.content) - } + {area.container.items + .slice() + .sort((a, b) => { + const index1 = a.config?.index || 0; + const index2 = b.config?.index || 0; + return index1 === index2 ? 0 : index1 > index2 ? 1 : -1; + }) + .map((item) => item.content)} </Fragment> ); } diff --git a/packages/editor-skeleton/src/layouts/sub-top-area.tsx b/packages/editor-skeleton/src/layouts/sub-top-area.tsx index cef6aa5b02..17c022639f 100644 --- a/packages/editor-skeleton/src/layouts/sub-top-area.tsx +++ b/packages/editor-skeleton/src/layouts/sub-top-area.tsx @@ -1,7 +1,7 @@ import { Component, Fragment } from 'react'; import classNames from 'classnames'; -import { observer } from '@alilc/lowcode-editor-core'; -import { Area } from '@alilc/lowcode-editor-skeleton'; +import { observer } from '@felce/lowcode-editor-core'; +import { Area } from '@felce/lowcode-editor-skeleton'; @observer export default class SubTopArea extends Component<{ area: Area; itemClassName?: string }> { @@ -13,9 +13,10 @@ export default class SubTopArea extends Component<{ area: Area; itemClassName?: } return ( - <div className={classNames('lc-workspace-sub-top-area lc-sub-top-area engine-actionpane', { - 'lc-area-visible': area.visible, - })} + <div + className={classNames('lc-workspace-sub-top-area lc-sub-top-area engine-actionpane', { + 'lc-area-visible': area.visible, + })} > <Contents area={area} itemClassName={itemClassName} /> </div> @@ -30,38 +31,43 @@ class Contents extends Component<{ area: Area; itemClassName?: string }> { const left: any[] = []; const center: any[] = []; const right: any[] = []; - area.container.items.slice().sort((a, b) => { - const index1 = a.config?.index || 0; - const index2 = b.config?.index || 0; - return index1 === index2 ? 0 : (index1 > index2 ? 1 : -1); - }).forEach(item => { - const content = ( - <div className={itemClassName || ''} key={`top-area-${item.name}`}> - {item.content} - </div> - ); - if (item.align === 'center') { - center.push(content); - } else if (item.align === 'left') { - left.push(content); - } else { - right.push(content); - } - }); + area.container.items + .slice() + .sort((a, b) => { + const index1 = a.config?.index || 0; + const index2 = b.config?.index || 0; + return index1 === index2 ? 0 : index1 > index2 ? 1 : -1; + }) + .forEach((item) => { + const content = ( + <div className={itemClassName || ''} key={`top-area-${item.name}`}> + {item.content} + </div> + ); + if (item.align === 'center') { + center.push(content); + } else if (item.align === 'left') { + left.push(content); + } else { + right.push(content); + } + }); let children = []; if (left && left.length) { - children.push(<div className="lc-workspace-sub-top-area-left lc-sub-top-area-left">{left}</div>); + children.push( + <div className="lc-workspace-sub-top-area-left lc-sub-top-area-left">{left}</div>, + ); } if (center && center.length) { - children.push(<div className="lc-workspace-sub-top-area-center lc-sub-top-area-center">{center}</div>); + children.push( + <div className="lc-workspace-sub-top-area-center lc-sub-top-area-center">{center}</div>, + ); } if (right && right.length) { - children.push(<div className="lc-workspace-sub-top-area-right lc-sub-top-area-right">{right}</div>); + children.push( + <div className="lc-workspace-sub-top-area-right lc-sub-top-area-right">{right}</div>, + ); } - return ( - <Fragment> - {children} - </Fragment> - ); + return <Fragment>{children}</Fragment>; } } diff --git a/packages/editor-skeleton/src/layouts/toolbar.tsx b/packages/editor-skeleton/src/layouts/toolbar.tsx index 9b7d1c9b68..81794a47b8 100644 --- a/packages/editor-skeleton/src/layouts/toolbar.tsx +++ b/packages/editor-skeleton/src/layouts/toolbar.tsx @@ -1,6 +1,6 @@ import { Component, Fragment } from 'react'; import classNames from 'classnames'; -import { observer } from '@alilc/lowcode-editor-core'; +import { observer } from '@felce/lowcode-editor-core'; import { Area } from '../area'; @observer diff --git a/packages/editor-skeleton/src/layouts/top-area.tsx b/packages/editor-skeleton/src/layouts/top-area.tsx index f6b84b3e6f..a49e63e43d 100644 --- a/packages/editor-skeleton/src/layouts/top-area.tsx +++ b/packages/editor-skeleton/src/layouts/top-area.tsx @@ -1,19 +1,24 @@ import { Component, Fragment } from 'react'; import classNames from 'classnames'; -import { observer } from '@alilc/lowcode-editor-core'; +import { observer } from '@felce/lowcode-editor-core'; import { Area } from '../area'; @observer -export default class TopArea extends Component<{ area: Area; itemClassName?: string; className?: string }> { +export default class TopArea extends Component<{ + area: Area; + itemClassName?: string; + className?: string; +}> { render() { const { area, itemClassName, className } = this.props; if (area.isEmpty()) { return null; } return ( - <div className={classNames(className, 'lc-top-area engine-actionpane', { - 'lc-area-visible': area.visible, - })} + <div + className={classNames(className, 'lc-top-area engine-actionpane', { + 'lc-area-visible': area.visible, + })} > <Contents area={area} itemClassName={itemClassName} /> </div> @@ -28,24 +33,27 @@ class Contents extends Component<{ area: Area; itemClassName?: string }> { const left: any[] = []; const center: any[] = []; const right: any[] = []; - area.container.items.slice().sort((a, b) => { - const index1 = a.config?.index || 0; - const index2 = b.config?.index || 0; - return index1 === index2 ? 0 : (index1 > index2 ? 1 : -1); - }).forEach(item => { - const content = ( - <div className={itemClassName || ''} key={`top-area-${item.name}`}> - {item.content} - </div> - ); - if (item.align === 'center') { - center.push(content); - } else if (item.align === 'left') { - left.push(content); - } else { - right.push(content); - } - }); + area.container.items + .slice() + .sort((a, b) => { + const index1 = a.config?.index || 0; + const index2 = b.config?.index || 0; + return index1 === index2 ? 0 : index1 > index2 ? 1 : -1; + }) + .forEach((item) => { + const content = ( + <div className={itemClassName || ''} key={`top-area-${item.name}`}> + {item.content} + </div> + ); + if (item.align === 'center') { + center.push(content); + } else if (item.align === 'left') { + left.push(content); + } else { + right.push(content); + } + }); return ( <Fragment> <div className="lc-top-area-left">{left}</div> diff --git a/packages/editor-skeleton/src/layouts/workbench.tsx b/packages/editor-skeleton/src/layouts/workbench.tsx index 1e412ed678..844789b30d 100644 --- a/packages/editor-skeleton/src/layouts/workbench.tsx +++ b/packages/editor-skeleton/src/layouts/workbench.tsx @@ -1,5 +1,5 @@ import { Component } from 'react'; -import { TipContainer, observer } from '@alilc/lowcode-editor-core'; +import { TipContainer, observer } from '@felce/lowcode-editor-core'; import classNames from 'classnames'; import { ISkeleton } from '../skeleton'; import TopArea from './top-area'; @@ -12,7 +12,7 @@ import BottomArea from './bottom-area'; import RightArea from './right-area'; import './workbench.less'; import { SkeletonContext } from '../context'; -import { EditorConfig, PluginClassSet } from '@alilc/lowcode-types'; +import { EditorConfig, PluginClassSet } from '@felce/lowcode-types'; @observer export class Workbench extends Component<{ @@ -29,11 +29,7 @@ export class Workbench extends Component<{ } render() { - const { - skeleton, - className, - topAreaItemClassName, - } = this.props; + const { skeleton, className, topAreaItemClassName } = this.props; return ( <div className={classNames('lc-workbench', className)}> <SkeletonContext.Provider value={this.props.skeleton}> diff --git a/packages/editor-skeleton/src/locale/index.ts b/packages/editor-skeleton/src/locale/index.ts index 4cb3b53cfb..33efdb0a93 100644 --- a/packages/editor-skeleton/src/locale/index.ts +++ b/packages/editor-skeleton/src/locale/index.ts @@ -1,4 +1,4 @@ -import { createIntl } from '@alilc/lowcode-editor-core'; +import { createIntl } from '@felce/lowcode-editor-core'; import enUS from './en-US.json'; import zhCN from './zh-CN.json'; diff --git a/packages/editor-skeleton/src/register-defaults.ts b/packages/editor-skeleton/src/register-defaults.ts index 573631f78e..8a5d566aaf 100644 --- a/packages/editor-skeleton/src/register-defaults.ts +++ b/packages/editor-skeleton/src/register-defaults.ts @@ -1,7 +1,7 @@ import parseJSFunc from './transducers/parse-func'; import parseProps from './transducers/parse-props'; import addonCombine from './transducers/addon-combine'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; export const registerDefaults = (ctx: IPublicModelPluginContext) => { const { material } = ctx; @@ -19,5 +19,4 @@ export const registerDefaults = (ctx: IPublicModelPluginContext) => { }; }; - registerDefaults.pluginName = '___register_defaults___'; diff --git a/packages/editor-skeleton/src/skeleton.ts b/packages/editor-skeleton/src/skeleton.ts index 7ff462391d..8b7d46f4cc 100644 --- a/packages/editor-skeleton/src/skeleton.ts +++ b/packages/editor-skeleton/src/skeleton.ts @@ -1,4 +1,11 @@ -import { action, makeObservable, obx, engineConfig, IEditor, FocusTracker } from '@alilc/lowcode-editor-core'; +import { + action, + makeObservable, + obx, + engineConfig, + IEditor, + FocusTracker, +} from '@felce/lowcode-editor-core'; import { DockConfig, WidgetConfig, @@ -18,7 +25,7 @@ import { PanelDock } from './widget/panel-dock'; import { Dock } from './widget/dock'; import { Stage, StageConfig } from './widget/stage'; import { isValidElement } from 'react'; -import { isPlainObject, uniqueId, Logger } from '@alilc/lowcode-utils'; +import { isPlainObject, uniqueId, Logger } from '@felce/lowcode-utils'; import { Divider } from '@alifd/next'; import { EditorConfig, @@ -29,7 +36,7 @@ import { IPublicApiSkeleton, IPublicTypeConfigTransducer, IPublicTypePanelConfig, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; const logger = new Logger({ level: 'warn', bizName: 'skeleton' }); @@ -44,22 +51,24 @@ export enum SkeletonEvents { WIDGET_ENABLE = 'skeleton.widget.enable', } -export interface ISkeleton extends Omit<IPublicApiSkeleton, - 'showPanel' | - 'hidePanel' | - 'showWidget' | - 'enableWidget' | - 'hideWidget' | - 'disableWidget' | - 'showArea' | - 'onShowPanel' | - 'onHidePanel' | - 'onShowWidget' | - 'onHideWidget' | - 'remove' | - 'hideArea' | - 'add' -> { +export interface ISkeleton + extends Omit< + IPublicApiSkeleton, + | 'showPanel' + | 'hidePanel' + | 'showWidget' + | 'enableWidget' + | 'hideWidget' + | 'disableWidget' + | 'showArea' + | 'onShowPanel' + | 'onHidePanel' + | 'onShowWidget' + | 'onHideWidget' + | 'remove' + | 'hideArea' + | 'add' + > { editor: IEditor; readonly leftArea: Area<DockConfig | PanelDockConfig | DialogDockConfig>; @@ -106,7 +115,10 @@ export interface ISkeleton extends Omit<IPublicApiSkeleton, createPanel(config: IPublicTypePanelConfig): Panel; - add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>): IWidget | Widget | Panel | Stage | Dock | PanelDock | undefined; + add( + config: IPublicTypeSkeletonConfig, + extraConfig?: Record<string, any>, + ): IWidget | Widget | Panel | Stage | Dock | PanelDock | undefined; } export class Skeleton implements ISkeleton { @@ -140,7 +152,10 @@ export class Skeleton implements ISkeleton { readonly focusTracker = new FocusTracker(); - constructor(readonly editor: IEditor, readonly viewName: string = 'global') { + constructor( + readonly editor: IEditor, + readonly viewName: string = 'global', + ) { makeObservable(this); this.leftArea = new Area( this, @@ -264,9 +279,13 @@ export class Skeleton implements ISkeleton { // adjust pinned status when panel shown this.editor.eventBus.on(SkeletonEvents.PANEL_SHOW, (panelName, panel) => { const panelNameKey = `${panelName}-pinned-status-isFloat`; - const isInFloatAreaPreferenceExists = engineConfig.getPreference()?.contains(panelNameKey, 'skeleton'); + const isInFloatAreaPreferenceExists = engineConfig + .getPreference() + ?.contains(panelNameKey, 'skeleton'); if (isInFloatAreaPreferenceExists) { - const isInFloatAreaFromPreference = engineConfig.getPreference()?.get(panelNameKey, 'skeleton'); + const isInFloatAreaFromPreference = engineConfig + .getPreference() + ?.get(panelNameKey, 'skeleton'); const isCurrentInFloatArea = panel?.isChildOfFloatArea(); if (isInFloatAreaFromPreference !== isCurrentInFloatArea) { this.toggleFloatStatus(panel); @@ -385,14 +404,19 @@ export class Skeleton implements ISkeleton { } getWidget(name: string): IWidget | undefined { - return this.widgets.find(widget => widget.name === name); + return this.widgets.find((widget) => widget.name === name); } createPanel(config: IPublicTypePanelConfig) { const parsedConfig = this.parseConfig(config); const panel = new Panel(this, parsedConfig as IPublicTypePanelConfig); this.panels.set(panel.name, panel); - logger.debug(`Panel created with name: ${panel.name} \nconfig:`, config, '\n current panels: ', this.panels); + logger.debug( + `Panel created with name: ${panel.name} \nconfig:`, + config, + '\n current panels: ', + this.panels, + ); return panel; } @@ -451,11 +475,7 @@ export class Skeleton implements ISkeleton { return restConfig; } - registerConfigTransducer( - transducer: IPublicTypeConfigTransducer, - level = 100, - id?: string, - ) { + registerConfigTransducer(transducer: IPublicTypeConfigTransducer, level = 100, id?: string) { transducer.level = level; transducer.id = id; const i = this.configTransducers.findIndex((item) => item.level != null && item.level > level); @@ -470,15 +490,21 @@ export class Skeleton implements ISkeleton { return this.configTransducers; } - add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>): IWidget | Widget | Panel | Stage | Dock | PanelDock | undefined { + add( + config: IPublicTypeSkeletonConfig, + extraConfig?: Record<string, any>, + ): IWidget | Widget | Panel | Stage | Dock | PanelDock | undefined { const registeredTransducers = this.getRegisteredConfigTransducers(); - const parsedConfig = registeredTransducers.reduce((prevConfig, current) => { - return current(prevConfig); - }, { - ...this.parseConfig(config), - ...extraConfig, - }); + const parsedConfig = registeredTransducers.reduce( + (prevConfig, current) => { + return current(prevConfig); + }, + { + ...this.parseConfig(config), + ...extraConfig, + }, + ); let { area } = parsedConfig; if (!area) { @@ -519,7 +545,7 @@ export class Skeleton implements ISkeleton { case 'stages': return this.stages.add(parsedConfig as StageConfig); default: - // do nothing + // do nothing } } } diff --git a/packages/editor-skeleton/src/transducers/addon-combine.ts b/packages/editor-skeleton/src/transducers/addon-combine.ts index c2bc2dd4c5..c8c5293939 100644 --- a/packages/editor-skeleton/src/transducers/addon-combine.ts +++ b/packages/editor-skeleton/src/transducers/addon-combine.ts @@ -2,9 +2,9 @@ import { IPublicTypeTransformedComponentMetadata, IPublicTypeFieldConfig, IPublicModelSettingField, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { IconSlot } from '../icons/slot'; -import { getConvertedExtraKey } from '@alilc/lowcode-designer'; +import { getConvertedExtraKey } from '@felce/lowcode-designer'; export default function ( metadata: IPublicTypeTransformedComponentMetadata, @@ -82,14 +82,18 @@ export default function ( eventsDefinition.push({ type: 'lifeCycleEvent', title: '生命周期', - list: supportedLifecycles.map((event: any) => (typeof event === 'string' ? { name: event } : event)), + list: supportedLifecycles.map((event: any) => + typeof event === 'string' ? { name: event } : event, + ), }); } if (supports.events) { eventsDefinition.push({ type: 'events', title: '事件', - list: (supports.events || []).map((event: any) => (typeof event === 'string' ? { name: event } : event)), + list: (supports.events || []).map((event: any) => + typeof event === 'string' ? { name: event } : event, + ), }); } // 通用设置 @@ -334,8 +338,10 @@ export default function ( }, tip: { type: 'i18n', - 'zh-CN': '搭配「条件渲染」或「循环渲染」时使用,和 react 组件中的 key 原理相同,点击查看帮助', - 'en-US': 'Used with 「Conditional Rendering」or「Cycle Rendering」, the same principle as the key in the react component, click to view the help', + 'zh-CN': + '搭配「条件渲染」或「循环渲染」时使用,和 react 组件中的 key 原理相同,点击查看帮助', + 'en-US': + 'Used with 「Conditional Rendering」or「Cycle Rendering」, the same principle as the key in the react component, click to view the help', }, docUrl: 'https://www.yuque.com/lce/doc/qm75w3', }, diff --git a/packages/editor-skeleton/src/transducers/parse-func.ts b/packages/editor-skeleton/src/transducers/parse-func.ts index bc52deec35..7bc4dcadbf 100644 --- a/packages/editor-skeleton/src/transducers/parse-func.ts +++ b/packages/editor-skeleton/src/transducers/parse-func.ts @@ -1,5 +1,5 @@ -import { IPublicTypeTransformedComponentMetadata } from '@alilc/lowcode-types'; -import { isPlainObject, isJSFunction, getLogger } from '@alilc/lowcode-utils'; +import { IPublicTypeTransformedComponentMetadata } from '@felce/lowcode-types'; +import { isPlainObject, isJSFunction, getLogger } from '@felce/lowcode-utils'; const leadingFnRe = /^function/; const leadingFnNameRe = /^\w+\s*\(/; @@ -43,20 +43,22 @@ function transformStringToFunction(str: string) { function parseJSFunc(obj: any, enableAllowedKeys = true) { if (!obj) return; - Object.keys(obj).forEach(key => { + Object.keys(obj).forEach((key) => { const item = obj[key]; if (isJSFunction(item)) { obj[key] = transformStringToFunction(item.value); } else if (Array.isArray(item)) { - item.forEach(o => parseJSFunc(o, enableAllowedKeys)); + item.forEach((o) => parseJSFunc(o, enableAllowedKeys)); } else if (isPlainObject(item)) { parseJSFunc(item, enableAllowedKeys); } }); } -export default function (metadata: IPublicTypeTransformedComponentMetadata): IPublicTypeTransformedComponentMetadata { +export default function ( + metadata: IPublicTypeTransformedComponentMetadata, +): IPublicTypeTransformedComponentMetadata { parseJSFunc(metadata, false); return metadata; -} \ No newline at end of file +} diff --git a/packages/editor-skeleton/src/transducers/parse-props.ts b/packages/editor-skeleton/src/transducers/parse-props.ts index 573d24ac62..38f57b2685 100644 --- a/packages/editor-skeleton/src/transducers/parse-props.ts +++ b/packages/editor-skeleton/src/transducers/parse-props.ts @@ -10,7 +10,7 @@ import { IPublicTypeOneOfType, ConfigureSupportEvent, IPublicModelSettingField, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; function propConfigToFieldConfig(propConfig: IPublicTypePropConfig): IPublicTypeFieldConfig { const { name, description } = propConfig; @@ -65,7 +65,8 @@ function propTypeToSetter(propType: IPublicTypePropType): IPublicTypeSetterType const dataSource = ((propType as IPublicTypeOneOf).value || []).map((value, index) => { const t = typeof value; return { - label: t === 'string' || t === 'number' || t === 'boolean' ? String(value) : `value ${index}`, + label: + t === 'string' || t === 'number' || t === 'boolean' ? String(value) : `value ${index}`, value, }; }); @@ -93,7 +94,9 @@ function propTypeToSetter(propType: IPublicTypePropType): IPublicTypeSetterType }; case 'shape': case 'exact': - const items = ((propType as any).value || []).map((item: any) => propConfigToFieldConfig(item)); + const items = ((propType as any).value || []).map((item: any) => + propConfigToFieldConfig(item), + ); return { componentName: 'ObjectSetter', props: { @@ -110,7 +113,11 @@ function propTypeToSetter(propType: IPublicTypePropType): IPublicTypeSetterType if (initial == null && item.setter && typeof item.setter === 'object') { initial = (item.setter as any).initialValue; } - data[item.name] = initial ? (typeof initial === 'function' ? initial(field) : initial) : null; + data[item.name] = initial + ? typeof initial === 'function' + ? initial(field) + : initial + : null; }); return data; }, @@ -121,7 +128,9 @@ function propTypeToSetter(propType: IPublicTypePropType): IPublicTypeSetterType componentName: 'ObjectSetter', props: { config: { - extraSetter: propTypeToSetter(typeName === 'objectOf' ? (propType as IPublicTypeObjectOf).value : 'any'), + extraSetter: propTypeToSetter( + typeName === 'objectOf' ? (propType as IPublicTypeObjectOf).value : 'any', + ), }, }, isRequired, @@ -132,7 +141,9 @@ function propTypeToSetter(propType: IPublicTypePropType): IPublicTypeSetterType return { componentName: 'ArraySetter', props: { - itemSetter: propTypeToSetter(typeName === 'arrayOf' ? (propType as IPublicTypeArrayOf).value : 'any'), + itemSetter: propTypeToSetter( + typeName === 'arrayOf' ? (propType as IPublicTypeArrayOf).value : 'any', + ), }, isRequired, initialValue: [], @@ -157,7 +168,7 @@ function propTypeToSetter(propType: IPublicTypePropType): IPublicTypeSetterType isRequired, }; default: - // do nothing + // do nothing } return { componentName: 'MixedSetter', @@ -168,7 +179,9 @@ function propTypeToSetter(propType: IPublicTypePropType): IPublicTypeSetterType const EVENT_RE = /^on|after|before[A-Z][\w]*$/; -export default function (metadata: IPublicTypeTransformedComponentMetadata): IPublicTypeTransformedComponentMetadata { +export default function ( + metadata: IPublicTypeTransformedComponentMetadata, +): IPublicTypeTransformedComponentMetadata { const { configure = {} } = metadata; // TODO types后续补充 let extendsProps: any = null; diff --git a/packages/editor-skeleton/src/types.ts b/packages/editor-skeleton/src/types.ts index 8c5f1484a0..b7b60c1818 100644 --- a/packages/editor-skeleton/src/types.ts +++ b/packages/editor-skeleton/src/types.ts @@ -6,7 +6,7 @@ import { IPublicTypePanelDockProps, IPublicTypePanelConfigProps, IPublicTypePanelConfig, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { IWidget } from './widget/widget'; export interface WidgetConfig extends IPublicTypeWidgetBaseConfig { @@ -23,8 +23,7 @@ export function isWidgetConfig(obj: any): obj is WidgetConfig { return obj && obj.type === 'Widget'; } -export interface DockProps extends IPublicTypePanelDockProps { -} +export interface DockProps extends IPublicTypePanelDockProps {} export interface DividerConfig extends IPublicTypeWidgetBaseConfig { type: 'Divider'; diff --git a/packages/editor-skeleton/src/widget/dock.ts b/packages/editor-skeleton/src/widget/dock.ts index 20cdd425da..4baa6f329f 100644 --- a/packages/editor-skeleton/src/widget/dock.ts +++ b/packages/editor-skeleton/src/widget/dock.ts @@ -1,7 +1,7 @@ import { ReactNode, createElement } from 'react'; -import { makeObservable, obx } from '@alilc/lowcode-editor-core'; -import { uniqueId, createContent } from '@alilc/lowcode-utils'; -import { getEvent } from '@alilc/lowcode-shell'; +import { makeObservable, obx } from '@felce/lowcode-editor-core'; +import { uniqueId, createContent } from '@felce/lowcode-utils'; +import { getEvent } from '@felce/lowcode-shell'; import { DockConfig } from '../types'; import { ISkeleton } from '../skeleton'; import { DockView, WidgetView } from '../components/widget-views'; @@ -59,7 +59,10 @@ export class Dock implements IWidget { return this._body; } - constructor(readonly skeleton: ISkeleton, readonly config: DockConfig) { + constructor( + readonly skeleton: ISkeleton, + readonly config: DockConfig, + ) { makeObservable(this); const { props = {}, name } = config; this.name = name; diff --git a/packages/editor-skeleton/src/widget/panel-dock.ts b/packages/editor-skeleton/src/widget/panel-dock.ts index 896849706a..c29d350811 100644 --- a/packages/editor-skeleton/src/widget/panel-dock.ts +++ b/packages/editor-skeleton/src/widget/panel-dock.ts @@ -1,5 +1,5 @@ -import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core'; -import { uniqueId } from '@alilc/lowcode-utils'; +import { obx, computed, makeObservable } from '@felce/lowcode-editor-core'; +import { uniqueId } from '@felce/lowcode-utils'; import { createElement, ReactNode, ReactInstance } from 'react'; import { ISkeleton } from '../skeleton'; import { PanelDockConfig } from '../types'; @@ -71,7 +71,10 @@ export class PanelDock implements IWidget { return this._panel || this.skeleton.getPanel(this.panelName); } - constructor(readonly skeleton: ISkeleton, readonly config: PanelDockConfig) { + constructor( + readonly skeleton: ISkeleton, + readonly config: PanelDockConfig, + ) { makeObservable(this); const { content, contentProps, panelProps, name, props } = config; this.name = name; diff --git a/packages/editor-skeleton/src/widget/panel.ts b/packages/editor-skeleton/src/widget/panel.ts index 3a1ce3b00b..424424e17d 100644 --- a/packages/editor-skeleton/src/widget/panel.ts +++ b/packages/editor-skeleton/src/widget/panel.ts @@ -1,9 +1,19 @@ import { createElement, ReactNode } from 'react'; -import { obx, computed, makeObservable, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core'; -import { uniqueId, createContent } from '@alilc/lowcode-utils'; -import { IPublicTypeHelpTipConfig, IPublicTypePanelConfig, IPublicTypeTitleContent } from '@alilc/lowcode-types'; +import { + obx, + computed, + makeObservable, + IEventBus, + createModuleEventBus, +} from '@felce/lowcode-editor-core'; +import { uniqueId, createContent } from '@felce/lowcode-utils'; +import { + IPublicTypeHelpTipConfig, + IPublicTypePanelConfig, + IPublicTypeTitleContent, +} from '@felce/lowcode-types'; import { WidgetContainer } from './widget-container'; -import { getEvent } from '@alilc/lowcode-shell'; +import { getEvent } from '@felce/lowcode-shell'; import { TitledPanelView, TabsPanelView, PanelView } from '../components/widget-views'; import { ISkeleton } from '../skeleton'; import { composeTitle } from './utils'; @@ -80,7 +90,10 @@ export class Panel implements IWidget { @obx.ref public parent?: WidgetContainer; - constructor(readonly skeleton: ISkeleton, readonly config: IPublicTypePanelConfig) { + constructor( + readonly skeleton: ISkeleton, + readonly config: IPublicTypePanelConfig, + ) { makeObservable(this); const { name, content, props = {} } = config; const { hideTitleBar, title, icon, description, help } = props; @@ -217,7 +230,7 @@ export class Panel implements IWidget { } getAssocDocks(): PanelDock[] { - return this.skeleton.widgets.filter(item => { + return this.skeleton.widgets.filter((item) => { return isPanelDock(item) && item.panelName === this.name; }) as any; } diff --git a/packages/editor-skeleton/src/widget/stage.ts b/packages/editor-skeleton/src/widget/stage.ts index 2b177af61f..d05ad1719b 100644 --- a/packages/editor-skeleton/src/widget/stage.ts +++ b/packages/editor-skeleton/src/widget/stage.ts @@ -1,4 +1,4 @@ -// import { uniqueId } from '@alilc/lowcode-utils'; +// import { uniqueId } from '@felce/lowcode-utils'; import { Widget } from './widget'; import { ISkeleton } from '../skeleton'; import { WidgetConfig } from '../types'; diff --git a/packages/editor-skeleton/src/widget/utils.ts b/packages/editor-skeleton/src/widget/utils.ts index bec41333c8..0fbc5d18e7 100644 --- a/packages/editor-skeleton/src/widget/utils.ts +++ b/packages/editor-skeleton/src/widget/utils.ts @@ -1,8 +1,14 @@ -import { IPublicTypeIconType, IPublicTypeTitleContent, TipContent } from '@alilc/lowcode-types'; -import { isI18nData, isTitleConfig } from '@alilc/lowcode-utils'; +import { IPublicTypeIconType, IPublicTypeTitleContent, TipContent } from '@felce/lowcode-types'; +import { isI18nData, isTitleConfig } from '@felce/lowcode-utils'; import { isValidElement } from 'react'; -export function composeTitle(title?: IPublicTypeTitleContent, icon?: IPublicTypeIconType, tip?: TipContent, tipAsTitle?: boolean, noIcon?: boolean) { +export function composeTitle( + title?: IPublicTypeTitleContent, + icon?: IPublicTypeIconType, + tip?: TipContent, + tipAsTitle?: boolean, + noIcon?: boolean, +) { let _title: IPublicTypeTitleContent | undefined; if (!title) { _title = {}; diff --git a/packages/editor-skeleton/src/widget/widget-container.ts b/packages/editor-skeleton/src/widget/widget-container.ts index 183ff8fe09..283df5dd2e 100644 --- a/packages/editor-skeleton/src/widget/widget-container.ts +++ b/packages/editor-skeleton/src/widget/widget-container.ts @@ -1,5 +1,5 @@ -import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core'; -import { hasOwnProperty } from '@alilc/lowcode-utils'; +import { obx, computed, makeObservable } from '@felce/lowcode-editor-core'; +import { hasOwnProperty } from '@felce/lowcode-utils'; import { isPanel } from './panel'; export interface WidgetItem { @@ -19,7 +19,7 @@ export class WidgetContainer<T extends WidgetItem = any, G extends WidgetItem = private maps: { [name: string]: T } = {}; - @obx.ref private _current: T & Activeable | null = null; + @obx.ref private _current: (T & Activeable) | null = null; get current() { return this._current; diff --git a/packages/editor-skeleton/src/widget/widget.ts b/packages/editor-skeleton/src/widget/widget.ts index c956738774..04c074e5b5 100644 --- a/packages/editor-skeleton/src/widget/widget.ts +++ b/packages/editor-skeleton/src/widget/widget.ts @@ -1,11 +1,11 @@ import { ReactNode, createElement } from 'react'; -import { makeObservable, obx } from '@alilc/lowcode-editor-core'; -import { createContent, uniqueId } from '@alilc/lowcode-utils'; -import { getEvent } from '@alilc/lowcode-shell'; +import { makeObservable, obx } from '@felce/lowcode-editor-core'; +import { createContent, uniqueId } from '@felce/lowcode-utils'; +import { getEvent } from '@felce/lowcode-shell'; import { WidgetConfig } from '../types'; import { ISkeleton } from '../skeleton'; import { WidgetView } from '../components/widget-views'; -import { IPublicTypeTitleContent, IPublicTypeWidgetBaseConfig } from '@alilc/lowcode-types'; +import { IPublicTypeTitleContent, IPublicTypeWidgetBaseConfig } from '@felce/lowcode-types'; export interface IWidget { readonly name: string; @@ -71,7 +71,10 @@ export class Widget implements IWidget { readonly title: IPublicTypeTitleContent; - constructor(readonly skeleton: ISkeleton, readonly config: WidgetConfig) { + constructor( + readonly skeleton: ISkeleton, + readonly config: WidgetConfig, + ) { makeObservable(this); const { props = {}, name } = config; this.name = name; diff --git a/packages/engine/README-en_US.md b/packages/engine/README-en_US.md new file mode 100644 index 0000000000..6f889e5e5b --- /dev/null +++ b/packages/engine/README-en_US.md @@ -0,0 +1,185 @@ +## Preface + +This project is forked from [alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) (v1.3.2 on September 6, 2024). +Since the original project's version 1 has been determined to no longer have community open source maintenance, and there is no definite plan for version 2. Therefore, this project was born, and it is expected to continue open source maintenance. +Of course, from now on, related designs will also be completely independent and not related to the design of the original project's version 2. If you expect to continue following the original project's version 2 route in the future, please choose this project carefully. + +### Changes in thinking + +This project will change some ideas, abandon some peripheral function development, mainly provide core low-code functions, and be a pure low-code kernel. Modules such as workspace will have a lower priority. +More internal modules will be transferred to plugins (incomplete) and provided as default plugins instead of being encapsulated inside. The overall development direction is shifting towards a more open one. +At the same time, for each sub-module, more interfaces will be opened through the shell module to support more customized needs. +Finally, the toolchain will be upgraded as appropriate. It is planned to switch to a newer packaging tool, etc., but the priority will be relatively low. + +### Plans + +Currently, the project has just been forked. The main work is to replace the namespace. To avoid naming conflicts with the original project, the namespace of this repository is adjusted to `@felce`, which is taken from the abbreviation of lowcode-engine. +Current main tasks: + +- Adjust the namespace of the main project. +- Fix backlogged issues. + +<h1 align="center">LowCodeEngine</h1> + +<div align="center"> + +An enterprise-class low-code technology stack with scale-out design + +[![NPM version][npm-image]][npm-url] [![NPM downloads][download-image]][download-url] + +[![][issues-helper-image]][issues-helper-url] [![Issues need help][help-wanted-image]][help-wanted-url] + +[![codecov][codecov-image-url]][codecov-url] [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/lowcode-workspace/awesome-lowcode-engine) + +[npm-image]: https://img.shields.io/npm/v/@felce/lowcode-engine.svg?style=flat-square +[npm-url]: http://npmjs.org/package/@felce/lowcode-engine +[download-image]: https://img.shields.io/npm/dm/@felce/lowcode-engine.svg?style=flat-square +[download-url]: https://npmjs.org/package/@felce/lowcode-engine +[help-wanted-image]: https://flat.badgen.net/github/label-issues/fe-lce/lowcode-engine/help%20wanted/open +[help-wanted-url]: https://github.com/fe-lce/lowcode-engine/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22 +[issues-helper-image]: https://img.shields.io/badge/using-issues--helper-orange?style=flat-square +[issues-helper-url]: https://github.com/actions-cool/issues-helper +[codecov-image-url]: https://codecov.io/gh/fe-lce/lowcode-engine/branch/main/graph/badge.svg +[codecov-url]: https://codecov.io/gh/fe-lce/lowcode-engine + +</div> + +[![](https://img.alicdn.com/imgextra/i2/O1CN01UhoS7C1sNNhySvfWi_!!6000000005754-2-tps-2878-1588.png)](http://lowcode-engine.cn) + +English | [简体中文](./README.md) + +## ✨ Features + +- 🌈 An extension-oriented kernel engine extracted from an enterprise-level low-code platform, pursuing the design concept of the smallest kernel and the strongest ecology +- 📦 Out-of-the-box high-quality ecological elements, including material systems, setters, plugins, etc. +- ⚙️ A complete tool chain, supporting the full-link R&D cycle of ecological elements such as material systems, setters, and plug-ins +- 🔌 Powerful expansion capability, has supported nearly 100 various vertical low-code platforms +- 🛡 Developed with TypeScript, providing complete type definition files + +## 🎯 Compatible Environments + +- Modern browsers (Chrome >= 80, Edge >= 80, last 2 safari versions, last 2 firefox versions) + +## 📚 Engine Protocol + +The engine fully implements the "LowCodeEngine Basic Construction Protocol Specification" and "LowCodeEngine Material Protocol Specification". The protocol stack is a key part of whether materials in the low-code field can be circulated. + +![image](https://img.alicdn.com/imgextra/i3/O1CN01IisBcy1dNBIg16QFM_!!6000000003723-2-tps-1916-1070.png) + +## 🌰 Usage example + +```bash +npm install @felce/lowcode-engine --save-dev +``` + +> **TIPS: Only cdn import is supported, npm package is used to provide code hinting capabilities such as typings** + +```ts +import { init, skeleton } from '@felce/lowcode-engine'; + +skeleton.add({ + area: 'topArea', + type: 'Widget', + name: 'logo', + content: YourFantasticLogo, + contentProps: { + logo: 'https://img.alicdn.com/tfs/TB1_SocGkT2gK0jSZFkXXcIQFXa-66-66.png', + href: '/', + }, + props: { + align: 'left', + width: 100, + }, +}); + +init(document.getElementById('lce')); +``` + +### Engineering configuration: + +```json +{ + "externals": { + "@felce/lowcode-engine": "var window.AliLowCodeEngine", + "@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt" + } +} +``` + +### cdn optional method: + +#### unpkg + +```html +https://unpkg.com/@felce/lowcode-engine@1.4.0-beta.0/dist/js/engine-core.js +https://unpkg.com/@felce/lowcode-react-simulator-renderer@1.4.0-beta.0/dist/js/react-simulator-renderer.js +``` + +#### npmmirror + +```html +https://registry.npmmirror.com/@felce/lowcode-engine/1.4.0-beta.0/files/dist/js/engine-core.js +https://registry.npmmirror.com/@felce/lowcode-react-simulator-renderer/1.4.0-beta.0/files/dist/js/react-simulator-renderer.js +``` + +#### jsdelivr + +```html +https://cdn.jsdelivr.net/npm/@felce/lowcode-engine@1.4.0-beta.0/dist/js/engine-core.js +https://cdn.jsdelivr.net/npm/@felce/lowcode-react-simulator-renderer@1.4.0-beta.0/dist/js/react-simulator-renderer.js +``` + +#### Method 5: Use your own cdn + +Pass the files under packages/engine/dist and packages/react-simulator-renderer/dist in the source code to your cdn provider + +## 🔗 Related Links + +- [Official website home page](http://lowcode-engine.cn/) +- [Demo Play Now](http://lowcode-engine.cn/demo) | [Engine Demo Repository](https://github.com/fe-lce/lowcode-demo) +- [Official Materials](https://github.com/fe-lce/lowcode-materials) +- [official setter](https://github.com/fe-lce/lowcode-engine-ext) +- [Official plugin (plugin)](https://github.com/fe-lce/lowcode-plugins) +- [Ecological elements (materials, setters, plugins) toolchain](https://lowcode-engine.cn/site/docs/guide/expand/editor/cli) +- [User Documentation](http://lowcode-engine.cn/doc) +- [API](https://lowcode-engine.cn/site/docs/api/) + +This [awesome-lowcode-engine](https://github.com/lowcode-workspace/awesome-lowcode-engine) page links to a repository which records all of the tools\materials\solutions that use or built for the lowcode-engine, PR is welcomed. + +## 💻 Local debugging + +```bash +$ git clone git@github.com:fe-lce/lowcode-engine.git +$ cd lowcode-engine +$ npm install +$ npm run setup +$ npm start +``` + +> 📢 npm access speed is slow, Alibaba employees can use tnpm, other students recommend using cnpm or specifying a mirror registry. +> +> 📢 Windows environment must use [WSL](https://docs.microsoft.com/en-us/windows/wsl/install), other terminals are not guaranteed to work normally + +After lowcode-engine is started, several umd files are provided, which can be debugged in combination with the [lowcode-demo](https://github.com/fe-lce/lowcode-demo) project. Refer to the file proxy rules [here](https://lowcode-engine.cn/site/docs/participate/prepare). + +## 🤝 Participation + +Please read first: + +1. [How to configure the engine debugging environment? ](https://lowcode-engine.cn/site/docs/participate/prepare) +2. [About the R&D collaboration process of the engine](https://lowcode-engine.cn/site/docs/participate/flow) +3. [Engineering Configuration of Engine](https://lowcode-engine.cn/site/docs/participate/config) + +> Strongly recommend reading ["The Wisdom of Asking Questions"](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way), ["How to Ask Questions to the Open Source Community"](https: //github.com/seajs/seajs/issues/545) and [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html), [ "How to Submit Unanswerable Questions to Open Source Projects"](https://zhuanlan.zhihu.com/p/25795393), better questions are easier to get help. (This paragraph refers to [antd](https://github.com/ant-design/ant-design)) + +About Pull Request: + +- set the target branch to **develop** other than **main** + +## ❤️ Contributors + +Special thanks to everyone who contributed to this project. + +<p> +<a href="https://github.com/fe-lce/lowcode-engine/graphs/contributors"><img src="https://contrib.rocks/image?repo=fe-lce/lowcode-engine" /></a> +</p> diff --git a/packages/engine/README-zh_CN.md b/packages/engine/README-zh_CN.md deleted file mode 100644 index 5442aa58bd..0000000000 --- a/packages/engine/README-zh_CN.md +++ /dev/null @@ -1,178 +0,0 @@ -<p align="center"> - <a href="https://lowcode-engine.cn"> - <img width="200" src="https://img.alicdn.com/imgextra/i3/O1CN01i8K9cD1d0HU7TjDtv_!!6000000003673-2-tps-500-591.png"> - </a> -</p> - -<h1 align="center">LowCodeEngine</h1> - -<div align="center"> - -一套面向扩展设计的企业级低代码技术体系 - -[![NPM version][npm-image]][npm-url] [![NPM downloads][download-image]][download-url] - -[![][issues-helper-image]][issues-helper-url] [![Issues need help][help-wanted-image]][help-wanted-url] - -[![codecov][codecov-image-url]][codecov-url] [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/lowcode-workspace/awesome-lowcode-engine) - -[![](https://img.shields.io/badge/LowCodeEngine-%E6%9F%A5%E7%9C%8B%E8%B4%A1%E7%8C%AE%E6%8E%92%E8%A1%8C%E6%A6%9C-orange)](https://opensource.alibaba.com/contribution_leaderboard/details?projectValue=lowcode-engine) - -[npm-image]: https://img.shields.io/npm/v/@alilc/lowcode-engine.svg?style=flat-square -[npm-url]: http://npmjs.org/package/@alilc/lowcode-engine - -[download-image]: https://img.shields.io/npm/dm/@alilc/lowcode-engine.svg?style=flat-square -[download-url]: https://npmjs.org/package/@alilc/lowcode-engine -[help-wanted-image]: https://flat.badgen.net/github/label-issues/alibaba/lowcode-engine/help%20wanted/open -[help-wanted-url]: https://github.com/alibaba/lowcode-engine/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22 - -[issues-helper-image]: https://img.shields.io/badge/using-issues--helper-orange?style=flat-square -[issues-helper-url]: https://github.com/actions-cool/issues-helper - -[codecov-image-url]: https://codecov.io/gh/alibaba/lowcode-engine/branch/main/graph/badge.svg -[codecov-url]: https://codecov.io/gh/alibaba/lowcode-engine - -</div> - -[![](https://img.alicdn.com/imgextra/i2/O1CN01UhoS7C1sNNhySvfWi_!!6000000005754-2-tps-2878-1588.png)](https://lowcode-engine.cn) - -简体中文 | [English](./README.md) - -## ✨ 特性 - -- 🌈 提炼自企业级低代码平台的面向扩展设计的内核引擎,奉行最小内核,最强生态的设计理念 -- 📦 开箱即用的高质量生态元素,包括 物料体系、设置器、插件 等 -- ⚙️ 完善的工具链,支持 物料体系、设置器、插件 等生态元素的全链路研发周期 -- 🔌 强大的扩展能力,已支撑 100+ 个各种类型低代码平台 -- 🛡 使用 TypeScript 开发,提供完整的类型定义文件 - -## 🎯 兼容环境 - -- 现代浏览器(Chrome >= 80, Edge >= 80, last 2 safari versions, last 2 firefox versions) - -## 📚 引擎协议 - -引擎完整实现了《低代码引擎搭建协议规范》和《低代码引擎物料协议规范》,协议栈是低代码领域的物料能否流通的关键部分。 - -![image](https://img.alicdn.com/imgextra/i3/O1CN01IisBcy1dNBIg16QFM_!!6000000003723-2-tps-1916-1070.png) - -## 🌰 使用示例 - -```bash -npm install @alilc/lowcode-engine --save-dev -``` - -> **TIPS:仅支持 cdn 方式引入,npm 包用于提供 typings 等代码提示能力** - -```ts -import { init, skeleton } from '@alilc/lowcode-engine'; - -skeleton.add({ - area: 'topArea', - type: 'Widget', - name: 'logo', - content: YourFantasticLogo, - contentProps: { - logo: - 'https://img.alicdn.com/tfs/TB1_SocGkT2gK0jSZFkXXcIQFXa-66-66.png', - href: '/', - }, - props: { - align: 'left', - width: 100, - }, -}); - -init(document.getElementById('lce')); -``` - -### 工程化配置: -```json -{ - "externals": { - "@alilc/lowcode-engine": "var window.AliLowCodeEngine", - "@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt" - } -} -``` - -### cdn 可选方式: -#### 方式 1(推荐):alifd cdn -```html -https://alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js - -https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@1.0.18/dist/js/react-simulator-renderer.js -``` - -#### 方式 2(推荐):uipaas cdn -```html -https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.0.18/dist/js/engine-core.js - -https://uipaas-assets.com/prod/npm/@alilc/lowcode-react-simulator-renderer/1.0.18/dist/js/react-simulator-renderer.js -``` - -#### 方式 3:unpkg -```html -https://unpkg.com/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js - -https://unpkg.com/@alilc/lowcode-react-simulator-renderer@1.0.18/dist/js/react-simulator-renderer.js -``` - -#### 方式 4:jsdelivr -```html -https://cdn.jsdelivr.net/npm/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js - -https://cdn.jsdelivr.net/npm/@alilc/lowcode-react-simulator-renderer@1.0.18/dist/js/react-simulator-renderer.js -``` - -#### 方式 5:使用自有 cdn -将源码中 packages/engine/dist 和 packages/react-simulator-renderer/dist 下的文件传至你的 cdn 提供商 - -## 🔗 相关链接 - -- [官网首页](https://lowcode-engine.cn/) -- [Demo 马上玩](https://lowcode-engine.cn/demo) | [引擎 Demo 仓库](https://github.com/alibaba/lowcode-demo) -- [官方物料](https://github.com/alibaba/lowcode-materials) -- [官方设置器(setter)](https://github.com/alibaba/lowcode-engine-ext) -- [官方插件(plugin)](https://github.com/alibaba/lowcode-plugins) -- [生态元素(物料、setter、插件)工具链](https://lowcode-engine.cn/site/docs/guide/expand/editor/cli) -- [用户文档](https://lowcode-engine.cn/doc) -- [API](https://lowcode-engine.cn/site/docs/api/) - -[awesome-lowcode-engine](https://github.com/lowcode-workspace/awesome-lowcode-engine) 中包含了一系列围绕引擎建设的工具、解决方案等,如果你有类似的解决方案或者工具,欢迎提 PR 到该仓库,让更多人了解到 - -## 💻 本地调试 - -```bash -$ git clone git@github.com:alibaba/lowcode-engine.git -$ cd lowcode-engine -$ npm install -$ npm run setup -$ npm start -``` - -> 📢 npm 访问速度较慢,阿里员工可以使用 tnpm,其他同学建议使用 cnpm 或者指定镜像 registry。 -> -> 📢 windows 环境必须使用 [WSL](https://docs.microsoft.com/zh-cn/windows/wsl/install),其他终端不保证能正常运行 - -lowcode-engine 启动后,提供了几个 umd 文件,可以结合 [lowcode-demo](https://github.com/alibaba/lowcode-demo) 项目做调试,文件代理规则参考[这里](https://lowcode-engine.cn/site/docs/participate/prepare#2-配置资源代理)。 - -## 🤝 参与共建 - -请先阅读: -1. [如何配置引擎调试环境?](https://lowcode-engine.cn/site/docs/participate/prepare) -2. [关于引擎的研发协作流程](https://lowcode-engine.cn/site/docs/participate/flow) -3. [引擎的工程化配置](https://lowcode-engine.cn/site/docs/participate/config) - -> 强烈推荐阅读 [《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)、[《如何向开源社区提问题》](https://github.com/seajs/seajs/issues/545) 和 [《如何有效地报告 Bug》](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html)、[《如何向开源项目提交无法解答的问题》](https://zhuanlan.zhihu.com/p/25795393),更好的问题更容易获得帮助。(此段参考 [antd](https://github.com/ant-design/ant-design)) - -关于提交 PR: -请将目标合并分支设置为 **develop**,不要指定 **main** 分支,在发布正式版本后,develop 分支将会合入 main 分支。 - -## ❤️ 致谢 - -感谢所有为引擎项目贡献力量的同学们~ - -<p> -<a href="https://github.com/alibaba/lowcode-engine/graphs/contributors"><img src="https://contrib.rocks/image?repo=alibaba/lowcode-engine" /></a> -</p> diff --git a/packages/engine/README.md b/packages/engine/README.md index ae4e7fd43b..e4a896ff98 100644 --- a/packages/engine/README.md +++ b/packages/engine/README.md @@ -1,14 +1,40 @@ -<p align="center"> - <a href="http://lowcode-engine.cn"> - <img width="200" src="https://img.alicdn.com/imgextra/i3/O1CN01i8K9cD1d0HU7TjDtv_!!6000000003673-2-tps-500-591.png"> - </a> -</p> +## 前言 + +本工程 fork 于[alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) (2024 年 9 月 6 日 v1.3.2)。 + +由于原工程 V1 确定不再进行社区开源维护,V2 版没有确切计划。因此诞生了本项目,期望继续开源维护。 + +当然,自此开始相关设计也会完全独立,与原工程 V2 的设计不相关联,如果期望后续能继续走原工程 V2 路线,请慎重选择本项目。 + +### 思想变化 + +本项目将转变部分思路,舍弃部分外围的功能开发,以提供核心低码功能为主,做纯粹低代码内核。如 workspace 等模块将降低优先级。 + +更多的内部模块将转移到 plugins 中(未完成),作为默认插件提供,而不是封装到内部。整体向更开放的开发方向转变。 + +同时,针对各子模块,将通过 shell 模块开放更多的接口,以支持更多定制化需求。 + +最后,将酌情升级工具链,计划切换到更新的打包工具等,不过优先级会比较低。 + +### 计划 + +目前工程刚 fork,主要工作是进行命名空间的替换,为避免与原工程命名冲突,本仓库命名空间调整为`@felce`,取自 lowcode-engine 的缩写。 +当前主要任务: + +- 主要工程的命名空间调整 +- 修复积压问题 + +## 联系方式 + +微信搜索 kunsile-002 添加我的微信,或者扫码加群: + +<img src="https://jxxg-wangjian.oss-cn-beijing.aliyuncs.com/static/lce-group-qrcode.jpg" width="200" /> <h1 align="center">LowCodeEngine</h1> <div align="center"> -An enterprise-class low-code technology stack with scale-out design +一套面向扩展设计的企业级低代码技术体系 [![NPM version][npm-image]][npm-url] [![NPM downloads][download-image]][download-url] @@ -16,56 +42,51 @@ An enterprise-class low-code technology stack with scale-out design [![codecov][codecov-image-url]][codecov-url] [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/lowcode-workspace/awesome-lowcode-engine) -[![](https://img.shields.io/badge/LowCodeEngine-Check%20Your%20Contribution-orange)](https://opensource.alibaba.com/contribution_leaderboard/details?projectValue=lowcode-engine) - -[npm-image]: https://img.shields.io/npm/v/@alilc/lowcode-engine.svg?style=flat-square -[npm-url]: http://npmjs.org/package/@alilc/lowcode-engine - -[download-image]: https://img.shields.io/npm/dm/@alilc/lowcode-engine.svg?style=flat-square -[download-url]: https://npmjs.org/package/@alilc/lowcode-engine -[help-wanted-image]: https://flat.badgen.net/github/label-issues/alibaba/lowcode-engine/help%20wanted/open -[help-wanted-url]: https://github.com/alibaba/lowcode-engine/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22 - +[npm-image]: https://img.shields.io/npm/v/@felce/lowcode-engine.svg?style=flat-square +[npm-url]: http://npmjs.org/package/@felce/lowcode-engine +[download-image]: https://img.shields.io/npm/dm/@felce/lowcode-engine.svg?style=flat-square +[download-url]: https://npmjs.org/package/@felce/lowcode-engine +[help-wanted-image]: https://flat.badgen.net/github/label-issues/fe-lce/lowcode-engine/help%20wanted/open +[help-wanted-url]: https://github.com/fe-lce/lowcode-engine/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22 [issues-helper-image]: https://img.shields.io/badge/using-issues--helper-orange?style=flat-square [issues-helper-url]: https://github.com/actions-cool/issues-helper - -[codecov-image-url]: https://codecov.io/gh/alibaba/lowcode-engine/branch/main/graph/badge.svg -[codecov-url]: https://codecov.io/gh/alibaba/lowcode-engine +[codecov-image-url]: https://codecov.io/gh/fe-lce/lowcode-engine/branch/main/graph/badge.svg +[codecov-url]: https://codecov.io/gh/fe-lce/lowcode-engine </div> -[![](https://img.alicdn.com/imgextra/i2/O1CN01UhoS7C1sNNhySvfWi_!!6000000005754-2-tps-2878-1588.png)](http://lowcode-engine.cn) +[![](https://img.alicdn.com/imgextra/i2/O1CN01UhoS7C1sNNhySvfWi_!!6000000005754-2-tps-2878-1588.png)](https://lowcode-engine.cn) -English | [简体中文](./packages/engine/README-zh_CN.md) +简体中文 | [English](packages/engine/README-en_US.md) -## ✨ Features +## ✨ 特性 -- 🌈 An extension-oriented kernel engine extracted from an enterprise-level low-code platform, pursuing the design concept of the smallest kernel and the strongest ecology -- 📦 Out-of-the-box high-quality ecological elements, including material systems, setters, plugins, etc. -- ⚙️ A complete tool chain, supporting the full-link R&D cycle of ecological elements such as material systems, setters, and plug-ins -- 🔌 Powerful expansion capability, has supported nearly 100 various vertical low-code platforms -- 🛡 Developed with TypeScript, providing complete type definition files +- 🌈 提炼自企业级低代码平台的面向扩展设计的内核引擎,奉行最小内核,最强生态的设计理念 +- 📦 开箱即用的高质量生态元素,包括 物料体系、设置器、插件 等 +- ⚙️ 完善的工具链,支持 物料体系、设置器、插件 等生态元素的全链路研发周期 +- 🔌 强大的扩展能力,已支撑 100+ 个各种类型低代码平台 +- 🛡 使用 TypeScript 开发,提供完整的类型定义文件 -## 🎯 Compatible Environments +## 🎯 兼容环境 -- Modern browsers (Chrome >= 80, Edge >= 80, last 2 safari versions, last 2 firefox versions) +- 现代浏览器(Chrome >= 80, Edge >= 80, last 2 safari versions, last 2 firefox versions) -## 📚 Engine Protocol +## 📚 引擎协议 -The engine fully implements the "LowCodeEngine Basic Construction Protocol Specification" and "LowCodeEngine Material Protocol Specification". The protocol stack is a key part of whether materials in the low-code field can be circulated. +引擎完整实现了《低代码引擎搭建协议规范》和《低代码引擎物料协议规范》,协议栈是低代码领域的物料能否流通的关键部分。 ![image](https://img.alicdn.com/imgextra/i3/O1CN01IisBcy1dNBIg16QFM_!!6000000003723-2-tps-1916-1070.png) -## 🌰 Usage example +## 🌰 使用示例 ```bash -npm install @alilc/lowcode-engine --save-dev +npm install @felce/lowcode-engine --save-dev ``` -> **TIPS: Only cdn import is supported, npm package is used to provide code hinting capabilities such as typings** +> **TIPS:仅支持 cdn 方式引入,npm 包用于提供 typings 等代码提示能力** ```ts -import { init, skeleton } from '@alilc/lowcode-engine'; +import { init, skeleton } from '@felce/lowcode-engine'; skeleton.add({ area: 'topArea', @@ -73,8 +94,7 @@ skeleton.add({ name: 'logo', content: YourFantasticLogo, contentProps: { - logo: - 'https://img.alicdn.com/tfs/TB1_SocGkT2gK0jSZFkXXcIQFXa-66-66.png', + logo: 'https://img.alicdn.com/tfs/TB1_SocGkT2gK0jSZFkXXcIQFXa-66-66.png', href: '/', }, props: { @@ -86,93 +106,90 @@ skeleton.add({ init(document.getElementById('lce')); ``` -### Engineering configuration: +### 工程化配置: + ```json { "externals": { - "@alilc/lowcode-engine": "var window.AliLowCodeEngine", + "@felce/lowcode-engine": "var window.AliLowCodeEngine", "@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt" } } ``` -### cdn optional method: -#### Method 1: alifd cdn -```html -https://alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js +### cdn 可选方式: -https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@1.0.18/dist/js/react-simulator-renderer.js -``` +#### unpkg -#### Method 2: uipaas cdn ```html -https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.0.18/dist/js/engine-core.js - -https://uipaas-assets.com/prod/npm/@alilc/lowcode-react-simulator-renderer/1.0.18/dist/js/react-simulator-renderer.js +https://unpkg.com/@felce/lowcode-engine@1.4.0-beta.0/dist/js/engine-core.js +https://unpkg.com/@felce/lowcode-react-simulator-renderer@1.4.0-beta.0/dist/js/react-simulator-renderer.js ``` -#### Method 3: unpkg -```html -https://unpkg.com/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js +#### npmmirror -https://unpkg.com/@alilc/lowcode-react-simulator-renderer@1.0.18/dist/js/react-simulator-renderer.js +```html +https://registry.npmmirror.com/@felce/lowcode-engine/1.4.0-beta.0/files/dist/js/engine-core.js +https://registry.npmmirror.com/@felce/lowcode-react-simulator-renderer/1.4.0-beta.0/files/dist/js/react-simulator-renderer.js ``` -#### Method 4: jsdelivr -```html -https://cdn.jsdelivr.net/npm/@alilc/lowcode-engine@1.0.18/dist/js/engine-core.js +#### jsdelivr -https://cdn.jsdelivr.net/npm/@alilc/lowcode-react-simulator-renderer@1.0.18/dist/js/react-simulator-renderer.js +```html +https://cdn.jsdelivr.net/npm/@felce/lowcode-engine@1.4.0-beta.0/dist/js/engine-core.js +https://cdn.jsdelivr.net/npm/@felce/lowcode-react-simulator-renderer@1.4.0-beta.0/dist/js/react-simulator-renderer.js ``` -#### Method 5: Use your own cdn -Pass the files under packages/engine/dist and packages/react-simulator-renderer/dist in the source code to your cdn provider +#### 使用自有 cdn + +将源码中 packages/engine/dist 和 packages/react-simulator-renderer/dist 下的文件传至你的 cdn 提供商 -## 🔗 Related Links +## 🔗 相关链接 -- [Official website home page](http://lowcode-engine.cn/) -- [Demo Play Now](http://lowcode-engine.cn/demo) | [Engine Demo Repository](https://github.com/alibaba/lowcode-demo) -- [Official Materials](https://github.com/alibaba/lowcode-materials) -- [official setter](https://github.com/alibaba/lowcode-engine-ext) -- [Official plugin (plugin)](https://github.com/alibaba/lowcode-plugins) -- [Ecological elements (materials, setters, plugins) toolchain](https://lowcode-engine.cn/site/docs/guide/expand/editor/cli) -- [User Documentation](http://lowcode-engine.cn/doc) +- [官网首页](https://lowcode-engine.cn/) +- [Demo 马上玩](https://lowcode-engine.cn/demo) | [引擎 Demo 仓库](https://github.com/fe-lce/lowcode-demo) +- [阿里物料](https://github.com/fe-lce/lowcode-materials) +- [官方设置器(setter)](https://github.com/fe-lce/lowcode-engine-ext) +- [官方插件(plugin)](https://github.com/fe-lce/lowcode-plugins) +- [生态元素(物料、setter、插件)工具链](https://lowcode-engine.cn/site/docs/guide/expand/editor/cli) +- [用户文档](https://lowcode-engine.cn/doc) - [API](https://lowcode-engine.cn/site/docs/api/) -This [awesome-lowcode-engine](https://github.com/lowcode-workspace/awesome-lowcode-engine) page links to a repository which records all of the tools\materials\solutions that use or built for the lowcode-engine, PR is welcomed. +[awesome-lowcode-engine](https://github.com/lowcode-workspace/awesome-lowcode-engine) 中包含了一系列围绕引擎建设的工具、解决方案等,如果你有类似的解决方案或者工具,欢迎提 PR 到该仓库,让更多人了解到 -## 💻 Local debugging +## 💻 本地调试 ```bash -$ git clone git@github.com:alibaba/lowcode-engine.git +$ git clone git@github.com:fe-lce/lowcode-engine.git $ cd lowcode-engine $ npm install $ npm run setup $ npm start ``` -> 📢 npm access speed is slow, Alibaba employees can use tnpm, other students recommend using cnpm or specifying a mirror registry. +> 📢 npm 访问速度较慢,建议使用 cnpm 或者指定镜像 registry。 > -> 📢 Windows environment must use [WSL](https://docs.microsoft.com/en-us/windows/wsl/install), other terminals are not guaranteed to work normally +> 📢 windows 环境必须使用 [WSL](https://docs.microsoft.com/zh-cn/windows/wsl/install),其他终端不保证能正常运行 + +lowcode-engine 启动后,提供了几个 umd 文件,可以结合 [lowcode-demo](https://github.com/fe-lce/lowcode-demo) 项目做调试,文件代理规则参考[这里](https://lowcode-engine.cn/site/docs/participate/prepare#2-配置资源代理)。 -After lowcode-engine is started, several umd files are provided, which can be debugged in combination with the [lowcode-demo](https://github.com/alibaba/lowcode-demo) project. Refer to the file proxy rules [here](https://lowcode-engine.cn/site/docs/participate/prepare). +## 🤝 参与共建 -## 🤝 Participation +请先阅读: -Please read first: -1. [How to configure the engine debugging environment? ](https://lowcode-engine.cn/site/docs/participate/prepare) -2. [About the R&D collaboration process of the engine](https://lowcode-engine.cn/site/docs/participate/flow) -3. [Engineering Configuration of Engine](https://lowcode-engine.cn/site/docs/participate/config) +1. [如何配置引擎调试环境?](https://lowcode-engine.cn/site/docs/participate/prepare) +2. [关于引擎的研发协作流程](https://lowcode-engine.cn/site/docs/participate/flow) +3. [引擎的工程化配置](https://lowcode-engine.cn/site/docs/participate/config) -> Strongly recommend reading ["The Wisdom of Asking Questions"](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way), ["How to Ask Questions to the Open Source Community"](https: //github.com/seajs/seajs/issues/545) and [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html), [ "How to Submit Unanswerable Questions to Open Source Projects"](https://zhuanlan.zhihu.com/p/25795393), better questions are easier to get help. (This paragraph refers to [antd](https://github.com/ant-design/ant-design)) +> 强烈推荐阅读 [《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)、[《如何向开源社区提问题》](https://github.com/seajs/seajs/issues/545) 和 [《如何有效地报告 Bug》](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html)、[《如何向开源项目提交无法解答的问题》](https://zhuanlan.zhihu.com/p/25795393),更好的问题更容易获得帮助。(此段参考 [antd](https://github.com/ant-design/ant-design)) -About Pull Request: -- set the target branch to **develop** other than **main** +关于提交 PR: +请将目标合并分支设置为 **develop**,不要指定 **main** 分支,在发布正式版本后,develop 分支将会合入 main 分支。 -## ❤️ Contributors +## ❤️ 致谢 -Special thanks to everyone who contributed to this project. +感谢所有为引擎项目贡献力量的同学们~ <p> -<a href="https://github.com/alibaba/lowcode-engine/graphs/contributors"><img src="https://contrib.rocks/image?repo=alibaba/lowcode-engine" /></a> +<a href="https://github.com/fe-lce/lowcode-engine/graphs/contributors"><img src="https://contrib.rocks/image?repo=fe-lce/lowcode-engine" /></a> </p> diff --git a/packages/engine/build.umd.json b/packages/engine/build.umd.json index f6c189068e..92d5a1bfd3 100644 --- a/packages/engine/build.umd.json +++ b/packages/engine/build.umd.json @@ -32,9 +32,12 @@ "externalNext": "umd" } ], - ["build-plugin-moment-locales", { - "locales": ["zh-cn"] - }], + [ + "build-plugin-moment-locales", + { + "locales": ["zh-cn"] + } + ], "./build.plugin.js" ] } diff --git a/packages/engine/package.json b/packages/engine/package.json index 23b3521213..b6e167d96e 100644 --- a/packages/engine/package.json +++ b/packages/engine/package.json @@ -1,6 +1,6 @@ { - "name": "@alilc/lowcode-engine", - "version": "1.3.2", + "name": "@felce/lowcode-engine", + "version": "1.4.0", "description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系", "main": "lib/engine-core.js", "module": "es/engine-core.js", @@ -12,23 +12,23 @@ "scripts": { "start": "build-scripts start", "version:update": "node ./scripts/version.js", - "build": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build", - "build:umd": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build --config build.umd.json", + "build": "build-scripts build", + "build:umd": "build-scripts build --config build.umd.json", "test": "build-scripts test --config build.test.json --jest-passWithNoTests" }, "license": "MIT", "dependencies": { - "@alifd/next": "^1.19.12", - "@alilc/lowcode-designer": "1.3.2", - "@alilc/lowcode-editor-core": "1.3.2", - "@alilc/lowcode-editor-skeleton": "1.3.2", + "@alifd/next": "^1.26.0", "@alilc/lowcode-engine-ext": "^1.0.0", - "@alilc/lowcode-plugin-command": "1.3.2", - "@alilc/lowcode-plugin-designer": "1.3.2", - "@alilc/lowcode-plugin-outline-pane": "1.3.2", - "@alilc/lowcode-shell": "1.3.2", - "@alilc/lowcode-utils": "1.3.2", - "@alilc/lowcode-workspace": "1.3.2", + "@felce/lowcode-designer": "1.4.0", + "@felce/lowcode-editor-core": "1.4.0", + "@felce/lowcode-editor-skeleton": "1.4.0", + "@felce/lowcode-plugin-command": "1.4.0", + "@felce/lowcode-plugin-designer": "1.4.0", + "@felce/lowcode-plugin-outline-pane": "1.4.0", + "@felce/lowcode-shell": "1.4.0", + "@felce/lowcode-utils": "1.4.0", + "@felce/lowcode-workspace": "1.4.0", "react": "^16.8.1", "react-dom": "^16.8.1" }, @@ -52,9 +52,9 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/engine" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/packages/engine" }, "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/packages/engine/src/engine-core.ts b/packages/engine/src/engine-core.ts index 4dffa628bd..3b4f3edaab 100644 --- a/packages/engine/src/engine-core.ts +++ b/packages/engine/src/engine-core.ts @@ -11,7 +11,7 @@ import { Hotkey as InnerHotkey, IEditor, Command as InnerCommand, -} from '@alilc/lowcode-editor-core'; +} from '@felce/lowcode-editor-core'; import { IPublicTypeEngineOptions, IPublicModelDocumentModel, @@ -21,7 +21,7 @@ import { IPublicApiWorkspace, IPublicEnumPluginRegisterLevel, IPublicModelPluginContext, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { Designer, LowCodePluginManager, @@ -29,16 +29,13 @@ import { ILowCodePluginContextApiAssembler, PluginPreference, IDesigner, -} from '@alilc/lowcode-designer'; -import { - Skeleton as InnerSkeleton, - registerDefaults, -} from '@alilc/lowcode-editor-skeleton'; +} from '@felce/lowcode-designer'; +import { Skeleton as InnerSkeleton, registerDefaults } from '@felce/lowcode-editor-skeleton'; import { Workspace as InnerWorkspace, Workbench as WorkSpaceWorkbench, IWorkspace, -} from '@alilc/lowcode-workspace'; +} from '@felce/lowcode-workspace'; import { Hotkey, @@ -55,8 +52,8 @@ import { Config, CommonUI, Command, -} from '@alilc/lowcode-shell'; -import { isPlainObject } from '@alilc/lowcode-utils'; +} from '@felce/lowcode-shell'; +import { isPlainObject } from '@felce/lowcode-utils'; import './modules/live-editing'; import * as classes from './modules/classes'; import symbols from './modules/symbols'; @@ -66,14 +63,18 @@ import { defaultPanelRegistry } from './inner-plugins/default-panel-registry'; import { shellModelFactory } from './modules/shell-model-factory'; import { builtinHotkey } from './inner-plugins/builtin-hotkey'; import { defaultContextMenu } from './inner-plugins/default-context-menu'; -import { CommandPlugin } from '@alilc/lowcode-plugin-command'; -import { OutlinePlugin } from '@alilc/lowcode-plugin-outline-pane'; +import { CommandPlugin } from '@felce/lowcode-plugin-command'; +import { OutlinePlugin } from '@felce/lowcode-plugin-outline-pane'; export * from './modules/skeleton-types'; export * from './modules/designer-types'; export * from './modules/lowcode-types'; -async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins: IPublicApiPlugins): Promise<IPublicTypeDisposable> { +async function registryInnerPlugin( + designer: IDesigner, + editor: IEditor, + plugins: IPublicApiPlugins, +): Promise<IPublicTypeDisposable> { // 注册一批内置插件 const componentMetaParserPlugin = componentMetaParser(designer); const defaultPanelRegistryPlugin = defaultPanelRegistry(editor); @@ -139,7 +140,11 @@ let plugins: Plugins; const pluginContextApiAssembler: ILowCodePluginContextApiAssembler = { // eslint-disable-next-line @typescript-eslint/no-unused-vars - assembleApis: (context: ILowCodePluginContextPrivate, pluginName: string, meta: IPublicTypePluginMeta) => { + assembleApis: ( + context: ILowCodePluginContextPrivate, + pluginName: string, + meta: IPublicTypePluginMeta, + ) => { context.hotkey = hotkey; context.project = project; context.skeleton = new Skeleton(innerSkeleton, pluginName, false); @@ -219,7 +224,7 @@ export async function init( container?: HTMLElement, options?: IPublicTypeEngineOptions, pluginPreference?: PluginPreference, - ) { +) { await destroy(); let engineOptions = null; if (isPlainObject(container)) { @@ -275,7 +280,7 @@ export async function destroy() { // remove all documents const { documents } = project; if (Array.isArray(documents) && documents.length > 0) { - documents.forEach(((doc: IPublicModelDocumentModel) => project.removeDocument(doc))); + documents.forEach((doc: IPublicModelDocumentModel) => project.removeDocument(doc)); } // TODO: delete plugins except for core plugins diff --git a/packages/engine/src/inner-plugins/builtin-hotkey.ts b/packages/engine/src/inner-plugins/builtin-hotkey.ts index 1a1f3a9c44..f507f0e0ff 100644 --- a/packages/engine/src/inner-plugins/builtin-hotkey.ts +++ b/packages/engine/src/inner-plugins/builtin-hotkey.ts @@ -1,5 +1,5 @@ /* eslint-disable max-len */ -import { isFormEvent, isNodeSchema, isNode } from '@alilc/lowcode-utils'; +import { isFormEvent, isNodeSchema, isNode } from '@felce/lowcode-utils'; import { IPublicModelPluginContext, IPublicEnumTransformStage, @@ -8,7 +8,7 @@ import { IPublicTypeNodeData, IPublicEnumDragObjectType, IPublicTypeDragNodeObject, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; function insertChild( container: IPublicModelNode, @@ -21,7 +21,7 @@ function insertChild( } let node = null; if (isNode(child)) { - node = (child as IPublicModelNode); + node = child as IPublicModelNode; container.children?.insert(node, at); } else { node = container.document?.createNode(child) || null; @@ -99,7 +99,11 @@ function getSuitableInsertion( } /* istanbul ignore next */ -function getNextForSelect(next: IPublicModelNode | null, head?: any, parent?: IPublicModelNode | null): any { +function getNextForSelect( + next: IPublicModelNode | null, + head?: any, + parent?: IPublicModelNode | null, +): any { if (next) { if (!head) { return next; @@ -130,7 +134,11 @@ function getNextForSelect(next: IPublicModelNode | null, head?: any, parent?: IP } /* istanbul ignore next */ -function getPrevForSelect(prev: IPublicModelNode | null, head?: any, parent?: IPublicModelNode | null): any { +function getPrevForSelect( + prev: IPublicModelNode | null, + head?: any, + parent?: IPublicModelNode | null, +): any { if (prev) { let ret; if (!head && prev.isContainerNode) { @@ -160,7 +168,11 @@ function getPrevForSelect(prev: IPublicModelNode | null, head?: any, parent?: IP return null; } -function getSuitablePlaceForNode(targetNode: IPublicModelNode, node: IPublicModelNode, ref: any): any { +function getSuitablePlaceForNode( + targetNode: IPublicModelNode, + node: IPublicModelNode, + ref: any, +): any { const { document } = targetNode; if (!document) { return null; @@ -292,7 +304,9 @@ export const builtinHotkey = (ctx: IPublicModelPluginContext) => { } const componentsMap = {}; - const componentsTree = selected.map((item) => item?.exportSchema(IPublicEnumTransformStage.Clone)); + const componentsTree = selected.map((item) => + item?.exportSchema(IPublicEnumTransformStage.Clone), + ); // FIXME: clear node.id diff --git a/packages/engine/src/inner-plugins/component-meta-parser.ts b/packages/engine/src/inner-plugins/component-meta-parser.ts index d0fbb4300f..7fba00175c 100644 --- a/packages/engine/src/inner-plugins/component-meta-parser.ts +++ b/packages/engine/src/inner-plugins/component-meta-parser.ts @@ -1,4 +1,4 @@ -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; export const componentMetaParser = (designer: any) => { const fun = (ctx: IPublicModelPluginContext) => { diff --git a/packages/engine/src/inner-plugins/default-context-menu.ts b/packages/engine/src/inner-plugins/default-context-menu.ts index 81978d9209..f7e48d2cfa 100644 --- a/packages/engine/src/inner-plugins/default-context-menu.ts +++ b/packages/engine/src/inner-plugins/default-context-menu.ts @@ -6,8 +6,8 @@ import { IPublicModelPluginContext, IPublicTypeDragNodeDataObject, IPublicTypeNodeSchema, -} from '@alilc/lowcode-types'; -import { isProjectSchema } from '@alilc/lowcode-utils'; +} from '@felce/lowcode-types'; +import { isProjectSchema } from '@felce/lowcode-utils'; import { Message } from '@alifd/next'; import { intl } from '../locale'; @@ -28,9 +28,7 @@ async function getClipboardText(): Promise<IPublicTypeNodeSchema[]> { resolve(data.componentsTree); } else { Message.error(intl('NotValidNodeData')); - reject( - new Error(intl('NotValidNodeData')), - ); + reject(new Error(intl('NotValidNodeData'))); } } catch (error) { Message.error(intl('NotValidNodeData')); @@ -137,7 +135,13 @@ export const defaultContextMenu = (ctx: IPublicModelPluginContext) => { return doc?.checkNesting(parent, dragNodeObject); }); if (canAddNodes.length === 0) { - Message.error(`${nodeSchema.map(d => utilsIntl(d.title || d.componentName)).join(',')}等组件无法放置到${utilsIntl(parent.title || parent.componentName as any)}内`); + Message.error( + `${nodeSchema + .map((d) => utilsIntl(d.title || d.componentName)) + .join(',')}等组件无法放置到${utilsIntl( + parent.title || (parent.componentName as any), + )}内`, + ); return; } const nodes: IPublicModelNode[] = []; @@ -185,7 +189,13 @@ export const defaultContextMenu = (ctx: IPublicModelPluginContext) => { return doc?.checkNesting(node, dragNodeObject); }); if (canAddNodes.length === 0) { - Message.error(`${nodeSchema.map(d => utilsIntl(d.title || d.componentName)).join(',')}等组件无法放置到${utilsIntl(node.title || node.componentName as any)}内`); + Message.error( + `${nodeSchema + .map((d) => utilsIntl(d.title || d.componentName)) + .join(',')}等组件无法放置到${utilsIntl( + node.title || (node.componentName as any), + )}内`, + ); return; } diff --git a/packages/engine/src/inner-plugins/default-panel-registry.tsx b/packages/engine/src/inner-plugins/default-panel-registry.tsx index b5f538d44c..1158eb7de5 100644 --- a/packages/engine/src/inner-plugins/default-panel-registry.tsx +++ b/packages/engine/src/inner-plugins/default-panel-registry.tsx @@ -1,6 +1,6 @@ -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; -import { SettingsPrimaryPane } from '@alilc/lowcode-editor-skeleton'; -import DesignerPlugin from '@alilc/lowcode-plugin-designer'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; +import { SettingsPrimaryPane } from '@felce/lowcode-editor-skeleton'; +import DesignerPlugin from '@felce/lowcode-plugin-designer'; // 注册默认的面板 export const defaultPanelRegistry = (editor: any) => { @@ -12,19 +12,14 @@ export const defaultPanelRegistry = (editor: any) => { area: 'mainArea', name: 'designer', type: 'Widget', - content: <DesignerPlugin - engineConfig={config} - engineEditor={editor} - />, + content: <DesignerPlugin engineConfig={config} engineEditor={editor} />, }); if (!config.get('disableDefaultSettingPanel')) { skeleton.add({ area: 'rightArea', name: 'settingsPane', type: 'Panel', - content: <SettingsPrimaryPane - engineEditor={editor} - />, + content: <SettingsPrimaryPane engineEditor={editor} />, props: { ignoreRoot: true, }, diff --git a/packages/engine/src/inner-plugins/setter-registry.ts b/packages/engine/src/inner-plugins/setter-registry.ts index 9d7fe4fccf..cdb6092d14 100644 --- a/packages/engine/src/inner-plugins/setter-registry.ts +++ b/packages/engine/src/inner-plugins/setter-registry.ts @@ -1,4 +1,4 @@ -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; // 注册默认的 setters export const setterRegistry = (ctx: IPublicModelPluginContext) => { diff --git a/packages/engine/src/locale/index.ts b/packages/engine/src/locale/index.ts index ca89840b05..edccba9611 100644 --- a/packages/engine/src/locale/index.ts +++ b/packages/engine/src/locale/index.ts @@ -1,4 +1,4 @@ -import { createIntl } from '@alilc/lowcode-editor-core'; +import { createIntl } from '@felce/lowcode-editor-core'; import enUS from './en-US.json'; import zhCN from './zh-CN.json'; diff --git a/packages/engine/src/modules/classes.ts b/packages/engine/src/modules/classes.ts index 3b7627deb0..0bc15ab89e 100644 --- a/packages/engine/src/modules/classes.ts +++ b/packages/engine/src/modules/classes.ts @@ -11,6 +11,5 @@ export { Prop, SimulatorHost, SkeletonItem, -} from '@alilc/lowcode-shell'; -export { Node as InnerNode } from '@alilc/lowcode-designer'; - +} from '@felce/lowcode-shell'; +export { Node as InnerNode } from '@felce/lowcode-designer'; diff --git a/packages/engine/src/modules/designer-types.ts b/packages/engine/src/modules/designer-types.ts index a0ee79952c..d5ec958be7 100644 --- a/packages/engine/src/modules/designer-types.ts +++ b/packages/engine/src/modules/designer-types.ts @@ -1,4 +1,4 @@ -import * as designerCabin from '@alilc/lowcode-designer'; +import * as designerCabin from '@felce/lowcode-designer'; // 这样做的目的是为了去除 Node / DocumentModel 等的值属性,仅保留类型属性 export type Node = designerCabin.Node; @@ -9,4 +9,4 @@ export type SaveHandler = designerCabin.SaveHandler; export type ComponentMeta = designerCabin.ComponentMeta; export type SettingField = designerCabin.SettingField; export type ILowCodePluginManager = designerCabin.ILowCodePluginManager; -export type PluginPreference = designerCabin.PluginPreference; \ No newline at end of file +export type PluginPreference = designerCabin.PluginPreference; diff --git a/packages/engine/src/modules/live-editing.ts b/packages/engine/src/modules/live-editing.ts index f1f32b88f7..fea2304e3d 100644 --- a/packages/engine/src/modules/live-editing.ts +++ b/packages/engine/src/modules/live-editing.ts @@ -1,5 +1,5 @@ -import { EditingTarget, Node as DocNode, SaveHandler, LiveEditing } from '@alilc/lowcode-designer'; -import { isJSExpression } from '@alilc/lowcode-utils'; +import { EditingTarget, Node as DocNode, SaveHandler, LiveEditing } from '@felce/lowcode-designer'; +import { isJSExpression } from '@felce/lowcode-utils'; function getText(node: DocNode, prop: string) { const p = node.getProp(prop, false); diff --git a/packages/engine/src/modules/lowcode-types.ts b/packages/engine/src/modules/lowcode-types.ts index 50618bd31d..f72045bab9 100644 --- a/packages/engine/src/modules/lowcode-types.ts +++ b/packages/engine/src/modules/lowcode-types.ts @@ -1 +1 @@ -export type { IPublicTypeNodeSchema } from '@alilc/lowcode-types'; \ No newline at end of file +export type { IPublicTypeNodeSchema } from '@felce/lowcode-types'; diff --git a/packages/engine/src/modules/shell-model-factory.ts b/packages/engine/src/modules/shell-model-factory.ts index 4271d126a3..e53c6d2f43 100644 --- a/packages/engine/src/modules/shell-model-factory.ts +++ b/packages/engine/src/modules/shell-model-factory.ts @@ -1,13 +1,7 @@ -import { - INode, - ISettingField, -} from '@alilc/lowcode-designer'; -import { IShellModelFactory, IPublicModelNode } from '@alilc/lowcode-types'; +import { INode, ISettingField } from '@felce/lowcode-designer'; +import { IShellModelFactory, IPublicModelNode } from '@felce/lowcode-types'; import { IPublicModelSettingField } from '../../../types/src/shell/model/setting-field'; -import { - Node, - SettingField, -} from '@alilc/lowcode-shell'; +import { Node, SettingField } from '@felce/lowcode-shell'; class ShellModelFactory implements IShellModelFactory { createNode(node: INode | null | undefined): IPublicModelNode | null { return Node.create(node); @@ -16,4 +10,4 @@ class ShellModelFactory implements IShellModelFactory { return SettingField.create(prop); } } -export const shellModelFactory = new ShellModelFactory(); \ No newline at end of file +export const shellModelFactory = new ShellModelFactory(); diff --git a/packages/engine/src/modules/skeleton-types.ts b/packages/engine/src/modules/skeleton-types.ts index 8cce1c08cc..0035f70df1 100644 --- a/packages/engine/src/modules/skeleton-types.ts +++ b/packages/engine/src/modules/skeleton-types.ts @@ -1,3 +1,3 @@ -import { IPublicTypeWidgetBaseConfig as innerIWidgetBaseConfig } from '@alilc/lowcode-types'; +import { IPublicTypeWidgetBaseConfig as innerIWidgetBaseConfig } from '@felce/lowcode-types'; export type IWidgetBaseConfig = innerIWidgetBaseConfig; diff --git a/packages/engine/src/modules/symbols.ts b/packages/engine/src/modules/symbols.ts index 55c70e5dcb..ce9f64adb0 100644 --- a/packages/engine/src/modules/symbols.ts +++ b/packages/engine/src/modules/symbols.ts @@ -15,7 +15,7 @@ import { editorCabinSymbol, skeletonCabinSymbol, simulatorRenderSymbol, -} from '@alilc/lowcode-shell'; +} from '@felce/lowcode-shell'; export default { projectSymbol, diff --git a/packages/ignitor/build.json b/packages/ignitor/build.json index f1956cf527..5b7ec07d65 100644 --- a/packages/ignitor/build.json +++ b/packages/ignitor/build.json @@ -16,15 +16,13 @@ "prop-types": "var window.PropTypes", "@alifd/next": "var window.Next", "rax": "var window.Rax", - "@alilc/lowcode-engine": "var window.AliLowCodeEngine", + "@felce/lowcode-engine": "var window.AliLowCodeEngine", "@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt", "moment": "var moment", "lodash": "var _" }, "plugins": [ - [ - "build-plugin-react-app" - ], + ["build-plugin-react-app"], [ "build-plugin-fusion", { @@ -35,9 +33,7 @@ [ "build-plugin-moment-locales", { - "locales": [ - "zh-cn" - ] + "locales": ["zh-cn"] } ], "./build.plugin.js" diff --git a/packages/ignitor/jest.config.js b/packages/ignitor/jest.config.js index 788c0ac79a..8bbadf8869 100644 --- a/packages/ignitor/jest.config.js +++ b/packages/ignitor/jest.config.js @@ -1,7 +1,7 @@ const fs = require('fs'); const { join } = require('path'); const esModules = [].join('|'); -const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.')); +const pkgNames = fs.readdirSync(join('..')).filter((pkgName) => !pkgName.startsWith('.')); const jestConfig = { // transform: { @@ -15,9 +15,7 @@ const jestConfig = { // testMatch: ['**/document-model.test.ts'], // testMatch: ['**/prop.test.ts'], // testMatch: ['(/tests?/.*(test))\\.[jt]s$'], - transformIgnorePatterns: [ - `/node_modules/(?!${esModules})/`, - ], + transformIgnorePatterns: [`/node_modules/(?!${esModules})/`], setupFiles: ['./tests/fixtures/unhandled-rejection.ts'], moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], collectCoverage: false, @@ -42,6 +40,6 @@ const jestConfig = { // 只对本仓库内的 pkg 做 mapping jestConfig.moduleNameMapper = {}; -jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; +jestConfig.moduleNameMapper[`^@felce/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; -module.exports = jestConfig; \ No newline at end of file +module.exports = jestConfig; diff --git a/packages/ignitor/package.json b/packages/ignitor/package.json index 0b109a7ad7..e71de7e671 100644 --- a/packages/ignitor/package.json +++ b/packages/ignitor/package.json @@ -1,6 +1,6 @@ { - "name": "@alilc/lowcode-ignitor", - "version": "1.3.2", + "name": "@felce/lowcode-ignitor", + "version": "1.4.0", "description": "点火器,bootstrap lce project", "main": "lib/index.js", "private": true, @@ -19,8 +19,8 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/ignitor" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/packages/ignitor" }, - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/packages/ignitor/public/index.html b/packages/ignitor/public/index.html index 147fe334d9..b53e23b215 100644 --- a/packages/ignitor/public/index.html +++ b/packages/ignitor/public/index.html @@ -1,20 +1,23 @@ <!DOCTYPE html> <html> - <head> - <meta charset="utf-8" /> - <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" /> - <meta name="viewport" content="width=device-width" /> - <title>LowCodeEngine Editor DEMO - - -

- This project only provides engine resource files. For usage, go for - Lowcode Demo -

-

- For local debugging of lowcode engine, please visit - proxy documentation - to get more information. -

- - + + + + + + LowCodeEngine Editor DEMO + + + +

+ This project only provides engine resource files. For usage, go for + Lowcode Demo +

+

+ For local debugging of lowcode engine, please visit + proxy documentation + to get more information. +

+ + + \ No newline at end of file diff --git a/packages/plugin-command/__tests__/node-command.test.ts b/packages/plugin-command/__tests__/node-command.test.ts index 2e9d21b35e..c0a556a816 100644 --- a/packages/plugin-command/__tests__/node-command.test.ts +++ b/packages/plugin-command/__tests__/node-command.test.ts @@ -1,9 +1,10 @@ -import { checkPropTypes } from '@alilc/lowcode-utils/src/check-prop-types'; +import { checkPropTypes } from '@felce/lowcode-utils/src/check-prop-types'; import { nodeSchemaPropType } from '../src/node-command'; describe('nodeSchemaPropType', () => { const componentName = 'NodeComponent'; - const getPropType = (name: string) => nodeSchemaPropType.value.find(d => d.name === name)?.propType; + const getPropType = (name: string) => + nodeSchemaPropType.value.find((d) => d.name === name)?.propType; it('should validate the id as a string', () => { const validId = 'node1'; @@ -17,10 +18,26 @@ describe('nodeSchemaPropType', () => { it('should validate the componentName as a string', () => { const validComponentName = 'Button'; const invalidComponentName = false; // Not a string - expect(checkPropTypes(validComponentName, 'componentName', getPropType('componentName'), componentName)).toBe(true); - expect(checkPropTypes(invalidComponentName, 'componentName', getPropType('componentName'), componentName)).toBe(false); + expect( + checkPropTypes( + validComponentName, + 'componentName', + getPropType('componentName'), + componentName, + ), + ).toBe(true); + expect( + checkPropTypes( + invalidComponentName, + 'componentName', + getPropType('componentName'), + componentName, + ), + ).toBe(false); // isRequired - expect(checkPropTypes(undefined, 'componentName', getPropType('componentName'), componentName)).toBe(false); + expect( + checkPropTypes(undefined, 'componentName', getPropType('componentName'), componentName), + ).toBe(false); }); it('should validate the props as an object', () => { @@ -48,15 +65,23 @@ describe('nodeSchemaPropType', () => { it('should validate the condition as a bool', () => { const validCondition = true; const invalidCondition = 'Not a bool'; // Not a boolean - expect(checkPropTypes(validCondition, 'condition', getPropType('condition'), componentName)).toBe(true); - expect(checkPropTypes(invalidCondition, 'condition', getPropType('condition'), componentName)).toBe(false); + expect( + checkPropTypes(validCondition, 'condition', getPropType('condition'), componentName), + ).toBe(true); + expect( + checkPropTypes(invalidCondition, 'condition', getPropType('condition'), componentName), + ).toBe(false); }); it('should validate the condition as a JSExpression', () => { const validCondition = { type: 'JSExpression', value: '1 + 1 === 2' }; const invalidCondition = { type: 'JSExpression', value: 123 }; // Not a string - expect(checkPropTypes(validCondition, 'condition', getPropType('condition'), componentName)).toBe(true); - expect(checkPropTypes(invalidCondition, 'condition', getPropType('condition'), componentName)).toBe(false); + expect( + checkPropTypes(validCondition, 'condition', getPropType('condition'), componentName), + ).toBe(true); + expect( + checkPropTypes(invalidCondition, 'condition', getPropType('condition'), componentName), + ).toBe(false); }); it('should validate the loop as an array', () => { @@ -76,32 +101,54 @@ describe('nodeSchemaPropType', () => { it('should validate the loopArgs as an array', () => { const validLoopArgs = ['item']; const invalidLoopArgs = 'Not an array'; // Not an array - expect(checkPropTypes(validLoopArgs, 'loopArgs', getPropType('loopArgs'), componentName)).toBe(true); - expect(checkPropTypes(invalidLoopArgs, 'loopArgs', getPropType('loopArgs'), componentName)).toBe(false); + expect(checkPropTypes(validLoopArgs, 'loopArgs', getPropType('loopArgs'), componentName)).toBe( + true, + ); + expect( + checkPropTypes(invalidLoopArgs, 'loopArgs', getPropType('loopArgs'), componentName), + ).toBe(false); }); it('should validate the loopArgs as a JSExpression', () => { const validLoopArgs = { type: 'JSExpression', value: 'item' }; const invalidLoopArgs = { type: 'JSExpression', value: 123 }; // Not a string - const validLoopArgs2 = [{ type: 'JSExpression', value: 'item' }, { type: 'JSExpression', value: 'index' }]; - expect(checkPropTypes(validLoopArgs, 'loopArgs', getPropType('loopArgs'), componentName)).toBe(true); - expect(checkPropTypes(invalidLoopArgs, 'loopArgs', getPropType('loopArgs'), componentName)).toBe(false); - expect(checkPropTypes(validLoopArgs2, 'loopArgs', getPropType('loopArgs'), componentName)).toBe(true); + const validLoopArgs2 = [ + { type: 'JSExpression', value: 'item' }, + { type: 'JSExpression', value: 'index' }, + ]; + expect(checkPropTypes(validLoopArgs, 'loopArgs', getPropType('loopArgs'), componentName)).toBe( + true, + ); + expect( + checkPropTypes(invalidLoopArgs, 'loopArgs', getPropType('loopArgs'), componentName), + ).toBe(false); + expect(checkPropTypes(validLoopArgs2, 'loopArgs', getPropType('loopArgs'), componentName)).toBe( + true, + ); }); it('should validate the children as an array', () => { - const validChildren = [{ - id: 'child1', - componentName: 'Button', - }, { - id: 'child2', - componentName: 'Button', - }]; + const validChildren = [ + { + id: 'child1', + componentName: 'Button', + }, + { + id: 'child2', + componentName: 'Button', + }, + ]; const invalidChildren = 'Not an array'; // Not an array const invalidChildren2 = [{}]; // Not an valid array - expect(checkPropTypes(invalidChildren, 'children', getPropType('children'), componentName)).toBe(false); - expect(checkPropTypes(validChildren, 'children', getPropType('children'), componentName)).toBe(true); - expect(checkPropTypes(invalidChildren2, 'children', getPropType('children'), componentName)).toBe(false); + expect( + checkPropTypes(invalidChildren, 'children', getPropType('children'), componentName), + ).toBe(false); + expect(checkPropTypes(validChildren, 'children', getPropType('children'), componentName)).toBe( + true, + ); + expect( + checkPropTypes(invalidChildren2, 'children', getPropType('children'), componentName), + ).toBe(false); }); afterEach(() => { diff --git a/packages/plugin-command/jest.config.js b/packages/plugin-command/jest.config.js index 822a526b7d..5d0fba0757 100644 --- a/packages/plugin-command/jest.config.js +++ b/packages/plugin-command/jest.config.js @@ -1,22 +1,17 @@ const fs = require('fs'); const { join } = require('path'); const esModules = [].join('|'); -const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.')); +const pkgNames = fs.readdirSync(join('..')).filter((pkgName) => !pkgName.startsWith('.')); const jestConfig = { - transformIgnorePatterns: [ - `/node_modules/(?!${esModules})/`, - ], + transformIgnorePatterns: [`/node_modules/(?!${esModules})/`], moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], collectCoverage: true, - collectCoverageFrom: [ - 'src/**/*.ts', - 'src/**/*.tsx', - ], + collectCoverageFrom: ['src/**/*.ts', 'src/**/*.tsx'], }; // 只对本仓库内的 pkg 做 mapping jestConfig.moduleNameMapper = {}; -jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '/../$1/src'; +jestConfig.moduleNameMapper[`^@felce/lowcode\\-(${pkgNames.join('|')})$`] = '/../$1/src'; -module.exports = jestConfig; \ No newline at end of file +module.exports = jestConfig; diff --git a/packages/plugin-command/package.json b/packages/plugin-command/package.json index 4f53e69e36..51bd003ae7 100644 --- a/packages/plugin-command/package.json +++ b/packages/plugin-command/package.json @@ -1,9 +1,9 @@ { - "name": "@alilc/lowcode-plugin-command", - "version": "1.3.2", + "name": "@felce/lowcode-plugin-command", + "version": "1.4.0", "description": "> TODO: description", "author": "liujuping ", - "homepage": "https://github.com/alibaba/lowcode-engine#readme", + "homepage": "https://github.com/fe-lce/lowcode-engine#readme", "license": "ISC", "main": "lib/index.js", "module": "es/index.js", @@ -20,18 +20,18 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/alibaba/lowcode-engine.git" + "url": "git+https://github.com/fe-lce/lowcode-engine.git" }, "scripts": { "test": "build-scripts test --config build.test.json --jest-passWithNoTests", "build": "build-scripts build" }, "bugs": { - "url": "https://github.com/alibaba/lowcode-engine/issues" + "url": "https://github.com/fe-lce/lowcode-engine/issues" }, "dependencies": { - "@alilc/lowcode-types": "1.3.2", - "@alilc/lowcode-utils": "1.3.2" + "@felce/lowcode-types": "1.4.0", + "@felce/lowcode-utils": "1.4.0" }, "devDependencies": { "@alib/build-scripts": "^0.1.18" diff --git a/packages/plugin-command/src/history-command.ts b/packages/plugin-command/src/history-command.ts index ea7e491bce..9a14658c44 100644 --- a/packages/plugin-command/src/history-command.ts +++ b/packages/plugin-command/src/history-command.ts @@ -1,4 +1,4 @@ -import { IPublicModelPluginContext, IPublicTypePlugin } from '@alilc/lowcode-types'; +import { IPublicModelPluginContext, IPublicTypePlugin } from '@felce/lowcode-types'; export const historyCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext) => { const { command, project } = ctx; diff --git a/packages/plugin-command/src/index.ts b/packages/plugin-command/src/index.ts index fa6f32b32d..b044267258 100644 --- a/packages/plugin-command/src/index.ts +++ b/packages/plugin-command/src/index.ts @@ -1,4 +1,4 @@ -import { IPublicModelPluginContext, IPublicTypePlugin } from '@alilc/lowcode-types'; +import { IPublicModelPluginContext, IPublicTypePlugin } from '@felce/lowcode-types'; import { nodeCommand } from './node-command'; import { historyCommand } from './history-command'; @@ -22,4 +22,4 @@ CommandPlugin.meta = { commandScope: 'common', }; -export default CommandPlugin; \ No newline at end of file +export default CommandPlugin; diff --git a/packages/plugin-command/src/node-command.ts b/packages/plugin-command/src/node-command.ts index eeda1d1688..15fc2e7233 100644 --- a/packages/plugin-command/src/node-command.ts +++ b/packages/plugin-command/src/node-command.ts @@ -1,5 +1,10 @@ -import { IPublicModelPluginContext, IPublicTypeNodeSchema, IPublicTypePlugin, IPublicTypePropType } from '@alilc/lowcode-types'; -import { isNodeSchema } from '@alilc/lowcode-utils'; +import { + IPublicModelPluginContext, + IPublicTypeNodeSchema, + IPublicTypePlugin, + IPublicTypePropType, +} from '@felce/lowcode-types'; +import { isNodeSchema } from '@felce/lowcode-utils'; const sampleNodeSchema: IPublicTypePropType = { type: 'shape', @@ -234,11 +239,7 @@ export const nodeCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext) = nodeSchema: IPublicTypeNodeSchema; index: number; }) => { - const { - parentNodeId, - nodeSchema, - index, - } = param; + const { parentNodeId, nodeSchema, index } = param; const { project } = ctx; const parentNode = project.currentDocument?.getNodeById(parentNodeId); if (!parentNode) { @@ -281,16 +282,8 @@ export const nodeCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext) = command.registerCommand({ name: 'move', description: 'Move a node to another node.', - handler(param: { - nodeId: string; - targetNodeId: string; - index: number; - }) { - const { - nodeId, - targetNodeId, - index = 0, - } = param; + handler(param: { nodeId: string; targetNodeId: string; index: number }) { + const { nodeId, targetNodeId, index = 0 } = param; if (!nodeId) { throw new Error('Invalid node id.'); @@ -349,12 +342,8 @@ export const nodeCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext) = command.registerCommand({ name: 'remove', description: 'Remove a node from the canvas.', - handler(param: { - nodeId: string; - }) { - const { - nodeId, - } = param; + handler(param: { nodeId: string }) { + const { nodeId } = param; const node = project.currentDocument?.getNodeById(nodeId); if (!node) { @@ -375,14 +364,8 @@ export const nodeCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext) = command.registerCommand({ name: 'update', description: 'Update a node.', - handler(param: { - nodeId: string; - nodeSchema: IPublicTypeNodeSchema; - }) { - const { - nodeId, - nodeSchema, - } = param; + handler(param: { nodeId: string; nodeSchema: IPublicTypeNodeSchema }) { + const { nodeId, nodeSchema } = param; const node = project.currentDocument?.getNodeById(nodeId); if (!node) { @@ -412,21 +395,15 @@ export const nodeCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext) = command.registerCommand({ name: 'updateProps', description: 'Update the properties of a node.', - handler(param: { - nodeId: string; - props: Record; - }) { - const { - nodeId, - props, - } = param; + handler(param: { nodeId: string; props: Record }) { + const { nodeId, props } = param; const node = project.currentDocument?.getNodeById(nodeId); if (!node) { throw new Error(`Can not find node '${nodeId}'.`); } - Object.keys(props).forEach(key => { + Object.keys(props).forEach((key) => { node.setPropValue(key, props[key]); }); }, @@ -447,21 +424,15 @@ export const nodeCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext) = command.registerCommand({ name: 'removeProps', description: 'Remove the properties of a node.', - handler(param: { - nodeId: string; - propNames: string[]; - }) { - const { - nodeId, - propNames, - } = param; + handler(param: { nodeId: string; propNames: string[] }) { + const { nodeId, propNames } = param; const node = project.currentDocument?.getNodeById(nodeId); if (!node) { throw new Error(`Can not find node '${nodeId}'.`); } - propNames.forEach(key => { + propNames.forEach((key) => { node.props?.getProp(key)?.remove(); }); }, @@ -494,4 +465,3 @@ nodeCommand.pluginName = '___node_command___'; nodeCommand.meta = { commandScope: 'node', }; - diff --git a/packages/plugin-designer/package.json b/packages/plugin-designer/package.json index ac25097c78..61b3298efd 100644 --- a/packages/plugin-designer/package.json +++ b/packages/plugin-designer/package.json @@ -1,6 +1,6 @@ { - "name": "@alilc/lowcode-plugin-designer", - "version": "1.3.2", + "name": "@felce/lowcode-plugin-designer", + "version": "1.4.0", "description": "alibaba lowcode editor designer plugin", "files": [ "es", @@ -18,9 +18,9 @@ ], "author": "xiayang.xy", "dependencies": { - "@alilc/lowcode-designer": "1.3.2", - "@alilc/lowcode-editor-core": "1.3.2", - "@alilc/lowcode-utils": "1.3.2", + "@felce/lowcode-designer": "1.4.0", + "@felce/lowcode-editor-core": "1.4.0", + "@felce/lowcode-utils": "1.4.0", "react": "^16.8.1", "react-dom": "^16.8.1" }, @@ -35,9 +35,9 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/plugin-designer" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/packages/plugin-designer" }, "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/packages/plugin-designer/src/index.tsx b/packages/plugin-designer/src/index.tsx index 51b81ff9d0..0183cf675b 100644 --- a/packages/plugin-designer/src/index.tsx +++ b/packages/plugin-designer/src/index.tsx @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react'; -import { Editor, engineConfig } from '@alilc/lowcode-editor-core'; -import { DesignerView, Designer } from '@alilc/lowcode-designer'; -import { Asset, getLogger } from '@alilc/lowcode-utils'; +import { Editor, engineConfig } from '@felce/lowcode-editor-core'; +import { DesignerView, Designer } from '@felce/lowcode-designer'; +import { Asset, getLogger } from '@felce/lowcode-utils'; import './index.scss'; const logger = getLogger({ level: 'warn', bizName: 'plugin:plugin-designer' }); @@ -58,7 +58,8 @@ export default class DesignerPlugin extends PureComponent= irect.top && globalY <= irect.bottom)) - && dragObject) { + if ( + originLoc && + ((pos && pos === 'unchanged') || + (irect && globalY >= irect.top && globalY <= irect.bottom)) && + dragObject + ) { const loc = originLoc.clone(e); const indented = this.indentTrack.getIndentParent(originLoc, loc); if (indented) { @@ -219,7 +227,7 @@ export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicTy } else { this.dwell.reset(); } - // FIXME: recreate new location + // FIXME: recreate new location } else if ((originLoc.detail as IPublicTypeLocationChildrenDetail).near) { (originLoc.detail as IPublicTypeLocationChildrenDetail).near = undefined; this.dwell.reset(); @@ -286,7 +294,12 @@ export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicTy return false; } const rect = this._shell.getBoundingClientRect(); - return e.globalY >= rect.top && e.globalY <= rect.bottom && e.globalX >= rect.left && e.globalX <= rect.right; + return ( + e.globalY >= rect.top && + e.globalY <= rect.bottom && + e.globalX >= rect.left && + e.globalX <= rect.right + ); } /** @@ -325,7 +338,9 @@ export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicTy if (!rect) { if (tryTimes < 3) { - this.tryScrollAgain = requestIdleCallback(() => this.scrollToNode(treeNode, detail, tryTimes + 1)); + this.tryScrollAgain = requestIdleCallback(() => + this.scrollToNode(treeNode, detail, tryTimes + 1), + ); } return; } @@ -333,7 +348,10 @@ export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicTy const { height, top, bottom } = this.bounds; if (rect.top < top || rect.bottom > bottom) { const opt: any = {}; - opt.top = Math.min(rect.top + rect.height / 2 + scrollTop - top - height / 2, scrollHeight - height); + opt.top = Math.min( + rect.top + rect.height / 2 + scrollTop - top - height / 2, + scrollHeight - height, + ); if (rect.height >= height) { opt.top = Math.min(scrollTop + rect.top - top, opt.top); } @@ -347,7 +365,12 @@ export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicTy /** -------------------- ITreeBoard end -------------------- */ - private getNear(treeNode: TreeNode, e: IPublicModelLocateEvent, originalIndex?: number, originalRect?: DOMRect) { + private getNear( + treeNode: TreeNode, + e: IPublicModelLocateEvent, + originalIndex?: number, + originalRect?: DOMRect, + ) { const { canvas, project } = this.pluginContext; const document = project.getCurrentDocument(); const { globalY, dragObject } = e; @@ -419,7 +442,9 @@ export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicTy index, valid: document?.checkNesting(node.parent!, dragObject as any), near: { node, pos: 'before' }, - focus: checkRecursion(focusNode, dragObject) ? { type: 'node', node: focusNode } : undefined, + focus: checkRecursion(focusNode, dragObject) + ? { type: 'node', node: focusNode } + : undefined, }, }); } @@ -446,12 +471,17 @@ export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicTy index: (index || 0) + 1, valid: document?.checkNesting(node.parent!, dragObject as any), near: { node, pos: 'after' }, - focus: checkRecursion(focusNode, dragObject) ? { type: 'node', node: focusNode } : undefined, + focus: checkRecursion(focusNode, dragObject) + ? { type: 'node', node: focusNode } + : undefined, }, }); } - private drillLocate(treeNode: TreeNode, e: IPublicModelLocateEvent): IPublicModelDropLocation | null { + private drillLocate( + treeNode: TreeNode, + e: IPublicModelLocateEvent, + ): IPublicModelDropLocation | null { const { canvas, project } = this.pluginContext; const document = project.getCurrentDocument(); const { dragObject, globalY } = e; @@ -615,25 +645,34 @@ export class PaneController implements IPublicModelSensor, ITreeBoard, IPublicTy if (!this._shell) { return undefined; } - return this._shell.querySelector(`.tree-node[data-id="${treeNode.nodeId}"]`)?.getBoundingClientRect(); + return this._shell + .querySelector(`.tree-node[data-id="${treeNode.nodeId}"]`) + ?.getBoundingClientRect(); } private getTreeTitleRect(treeNode: TreeNode): DOMRect | undefined { if (!this._shell) { return undefined; } - return this._shell.querySelector(`.tree-node-title[data-id="${treeNode.nodeId}"]`)?.getBoundingClientRect(); + return this._shell + .querySelector(`.tree-node-title[data-id="${treeNode.nodeId}"]`) + ?.getBoundingClientRect(); } private getTreeSlotsRect(treeNode: TreeNode): DOMRect | undefined { if (!this._shell) { return undefined; } - return this._shell.querySelector(`.tree-node-slots[data-id="${treeNode.nodeId}"]`)?.getBoundingClientRect(); + return this._shell + .querySelector(`.tree-node-slots[data-id="${treeNode.nodeId}"]`) + ?.getBoundingClientRect(); } } -function checkRecursion(parent: IPublicModelNode | undefined | null, dragObject: IPublicModelDragObject): boolean { +function checkRecursion( + parent: IPublicModelNode | undefined | null, + dragObject: IPublicModelDragObject, +): boolean { if (!parent) { return false; } diff --git a/packages/plugin-outline-pane/src/controllers/tree-master.ts b/packages/plugin-outline-pane/src/controllers/tree-master.ts index f86ce3deca..b08f45db2b 100644 --- a/packages/plugin-outline-pane/src/controllers/tree-master.ts +++ b/packages/plugin-outline-pane/src/controllers/tree-master.ts @@ -1,5 +1,11 @@ -import { isLocationChildrenDetail } from '@alilc/lowcode-utils'; -import { IPublicModelPluginContext, IPublicTypeActiveTarget, IPublicModelNode, IPublicTypeDisposable, IPublicEnumPluginRegisterLevel } from '@alilc/lowcode-types'; +import { isLocationChildrenDetail } from '@felce/lowcode-utils'; +import { + IPublicModelPluginContext, + IPublicTypeActiveTarget, + IPublicModelNode, + IPublicTypeDisposable, + IPublicEnumPluginRegisterLevel, +} from '@felce/lowcode-types'; import TreeNode from './tree-node'; import { Tree } from './tree'; import EventEmitter from 'events'; @@ -33,9 +39,12 @@ export class TreeMaster { event = new EventEmitter(); - constructor(pluginContext: IPublicModelPluginContext, readonly options: { - extraTitle?: string; - }) { + constructor( + pluginContext: IPublicModelPluginContext, + readonly options: { + extraTitle?: string; + }, + ) { this.setPluginContext(pluginContext); const { workspace } = this.pluginContext; this.initEvent(); @@ -79,7 +88,7 @@ export class TreeMaster { } private disposeEvent() { - this.disposeEvents.forEach(d => { + this.disposeEvents.forEach((d) => { d && d(); }); } @@ -90,7 +99,7 @@ export class TreeMaster { const setExpandByActiveTracker = (target: IPublicTypeActiveTarget) => { const { node, detail } = target; const tree = this.currentTree; - if (!tree/* || node.document !== tree.document */) { + if (!tree /* || node.document !== tree.document */) { return; } const treeNode = tree.getTreeNode(node); @@ -121,14 +130,15 @@ export class TreeMaster { } const npm = n?.componentMeta?.npm; return ( - [npm?.package, npm?.componentName].filter((item) => !!item).join('-') || n?.componentMeta?.componentName + [npm?.package, npm?.componentName].filter((item) => !!item).join('-') || + n?.componentMeta?.componentName ); }) .join('&'), time: (endTime - startTime).toFixed(2), }); }), - project.onRemoveDocument((data: {id: string}) => { + project.onRemoveDocument((data: { id: string }) => { const { id } = data; this.treeMap.delete(id); }), diff --git a/packages/plugin-outline-pane/src/controllers/tree-node.ts b/packages/plugin-outline-pane/src/controllers/tree-node.ts index 34d06fee0b..0d36ccff75 100644 --- a/packages/plugin-outline-pane/src/controllers/tree-node.ts +++ b/packages/plugin-outline-pane/src/controllers/tree-node.ts @@ -3,8 +3,8 @@ import { IPublicTypeLocationChildrenDetail, IPublicModelNode, IPublicTypeDisposable, -} from '@alilc/lowcode-types'; -import { isI18nData, isLocationChildrenDetail, uniqueId } from '@alilc/lowcode-utils'; +} from '@felce/lowcode-types'; +import { isI18nData, isLocationChildrenDetail, uniqueId } from '@felce/lowcode-utils'; import EventEmitter from 'events'; import { Tree } from './tree'; import { IOutlinePanelPluginContext } from './tree-master'; @@ -83,7 +83,9 @@ export default class TreeNode { */ get dropDetail(): IPublicTypeLocationChildrenDetail | undefined | null { const loc = this.pluginContext.project.getCurrentDocument()?.dropLocation; - return loc && this.isResponseDropping() && isLocationChildrenDetail(loc.detail) ? loc.detail : null; + return loc && this.isResponseDropping() && isLocationChildrenDetail(loc.detail) + ? loc.detail + : null; } get depth(): number { @@ -92,7 +94,7 @@ export default class TreeNode { get detecting() { const doc = this.pluginContext.project.currentDocument; - return !!(doc?.isDetectingNode(this.node)); + return !!doc?.isDetectingNode(this.node); } get hidden(): boolean { @@ -260,7 +262,9 @@ export default class TreeNode { return false; } return ( - isLocationChildrenDetail(loc.detail) && loc.detail.focus?.type === 'node' && loc.detail?.focus?.node.id === this.nodeId + isLocationChildrenDetail(loc.detail) && + loc.detail.focus?.type === 'node' && + loc.detail?.focus?.node.id === this.nodeId ); } diff --git a/packages/plugin-outline-pane/src/controllers/tree.ts b/packages/plugin-outline-pane/src/controllers/tree.ts index ca5a43c554..b5b136c216 100644 --- a/packages/plugin-outline-pane/src/controllers/tree.ts +++ b/packages/plugin-outline-pane/src/controllers/tree.ts @@ -1,5 +1,5 @@ import TreeNode from './tree-node'; -import { IPublicModelNode, IPublicTypePropChangeOptions } from '@alilc/lowcode-types'; +import { IPublicModelNode, IPublicTypePropChangeOptions } from '@felce/lowcode-types'; import { IOutlinePanelPluginContext, TreeMaster } from './tree-master'; export class Tree { @@ -24,7 +24,7 @@ export class Tree { const doc = this.pluginContext.project.currentDocument; this.id = doc?.id; - doc?.onChangeNodeChildren((info: {node: IPublicModelNode }) => { + doc?.onChangeNodeChildren((info: { node: IPublicModelNode }) => { const { node } = info; const treeNode = this.getTreeNodeById(node.id); treeNode?.notifyExpandableChanged(); diff --git a/packages/plugin-outline-pane/src/helper/dwell-timer.ts b/packages/plugin-outline-pane/src/helper/dwell-timer.ts index c35dc0d117..9757232d8d 100644 --- a/packages/plugin-outline-pane/src/helper/dwell-timer.ts +++ b/packages/plugin-outline-pane/src/helper/dwell-timer.ts @@ -1,6 +1,9 @@ -import { isLocationChildrenDetail } from '@alilc/lowcode-utils'; -import { IPublicModelNode, IPublicModelDropLocation, IPublicModelLocateEvent } from '@alilc/lowcode-types'; - +import { isLocationChildrenDetail } from '@felce/lowcode-utils'; +import { + IPublicModelNode, + IPublicModelDropLocation, + IPublicModelLocateEvent, +} from '@felce/lowcode-types'; /** * 停留检查计时器 @@ -16,7 +19,10 @@ export default class DwellTimer { private timeout = 500; - constructor(decide: (node: IPublicModelNode, event: IPublicModelLocateEvent) => void, timeout = 500) { + constructor( + decide: (node: IPublicModelNode, event: IPublicModelLocateEvent) => void, + timeout = 500, + ) { this.decide = decide; this.timeout = timeout; } diff --git a/packages/plugin-outline-pane/src/helper/indent-track.ts b/packages/plugin-outline-pane/src/helper/indent-track.ts index a9965bf291..57acfdb97a 100644 --- a/packages/plugin-outline-pane/src/helper/indent-track.ts +++ b/packages/plugin-outline-pane/src/helper/indent-track.ts @@ -1,6 +1,5 @@ -import { isLocationChildrenDetail } from '@alilc/lowcode-utils'; -import { IPublicModelDropLocation, IPublicModelNode } from '@alilc/lowcode-types'; - +import { isLocationChildrenDetail } from '@felce/lowcode-utils'; +import { IPublicModelDropLocation, IPublicModelNode } from '@felce/lowcode-types'; const IndentSensitive = 15; export class IndentTrack { @@ -11,7 +10,10 @@ export class IndentTrack { } // eslint-disable-next-line max-len - getIndentParent(lastLoc: IPublicModelDropLocation, loc: IPublicModelDropLocation): [IPublicModelNode, number | undefined] | null { + getIndentParent( + lastLoc: IPublicModelDropLocation, + loc: IPublicModelDropLocation, + ): [IPublicModelNode, number | undefined] | null { if ( lastLoc.target !== loc.target || !isLocationChildrenDetail(lastLoc.detail) || diff --git a/packages/plugin-outline-pane/src/icons/arrow-right.tsx b/packages/plugin-outline-pane/src/icons/arrow-right.tsx index 0a1418746b..1d9ab6fa81 100644 --- a/packages/plugin-outline-pane/src/icons/arrow-right.tsx +++ b/packages/plugin-outline-pane/src/icons/arrow-right.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconArrowRight(props: IconProps) { return ( diff --git a/packages/plugin-outline-pane/src/icons/cond.tsx b/packages/plugin-outline-pane/src/icons/cond.tsx index 7423b41396..b66972d434 100644 --- a/packages/plugin-outline-pane/src/icons/cond.tsx +++ b/packages/plugin-outline-pane/src/icons/cond.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconCond(props: IconProps) { return ( diff --git a/packages/plugin-outline-pane/src/icons/delete.tsx b/packages/plugin-outline-pane/src/icons/delete.tsx index 1f93600196..ab2234f21c 100644 --- a/packages/plugin-outline-pane/src/icons/delete.tsx +++ b/packages/plugin-outline-pane/src/icons/delete.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconDelete(props: IconProps) { return ( diff --git a/packages/plugin-outline-pane/src/icons/eye-close.tsx b/packages/plugin-outline-pane/src/icons/eye-close.tsx index e6e35f3264..a7ea0f2e3c 100644 --- a/packages/plugin-outline-pane/src/icons/eye-close.tsx +++ b/packages/plugin-outline-pane/src/icons/eye-close.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconEyeClose(props: IconProps) { return ( diff --git a/packages/plugin-outline-pane/src/icons/eye.tsx b/packages/plugin-outline-pane/src/icons/eye.tsx index fd1fbad4a6..56d48ca28c 100644 --- a/packages/plugin-outline-pane/src/icons/eye.tsx +++ b/packages/plugin-outline-pane/src/icons/eye.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconEye(props: IconProps) { return ( diff --git a/packages/plugin-outline-pane/src/icons/filter.tsx b/packages/plugin-outline-pane/src/icons/filter.tsx index 11e2f719d0..dd2c163f23 100644 --- a/packages/plugin-outline-pane/src/icons/filter.tsx +++ b/packages/plugin-outline-pane/src/icons/filter.tsx @@ -1,9 +1,13 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconFilter(props: IconProps) { return ( - + ); } diff --git a/packages/plugin-outline-pane/src/icons/lock.tsx b/packages/plugin-outline-pane/src/icons/lock.tsx index f5ead19c40..afa57aa627 100644 --- a/packages/plugin-outline-pane/src/icons/lock.tsx +++ b/packages/plugin-outline-pane/src/icons/lock.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconLock(props: IconProps) { return ( diff --git a/packages/plugin-outline-pane/src/icons/loop.tsx b/packages/plugin-outline-pane/src/icons/loop.tsx index f128dd4605..77d8f845f5 100644 --- a/packages/plugin-outline-pane/src/icons/loop.tsx +++ b/packages/plugin-outline-pane/src/icons/loop.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconLoop(props: IconProps) { return ( diff --git a/packages/plugin-outline-pane/src/icons/outline.tsx b/packages/plugin-outline-pane/src/icons/outline.tsx index a3b7654e1e..cede092bc7 100644 --- a/packages/plugin-outline-pane/src/icons/outline.tsx +++ b/packages/plugin-outline-pane/src/icons/outline.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconOutline(props: IconProps) { return ( @@ -9,4 +9,3 @@ export function IconOutline(props: IconProps) { } IconOutline.displayName = 'IconOutline'; - diff --git a/packages/plugin-outline-pane/src/icons/radio-active.tsx b/packages/plugin-outline-pane/src/icons/radio-active.tsx index dcd4e938dc..90a3b8825f 100644 --- a/packages/plugin-outline-pane/src/icons/radio-active.tsx +++ b/packages/plugin-outline-pane/src/icons/radio-active.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconRadioActive(props: IconProps) { return ( @@ -9,4 +9,3 @@ export function IconRadioActive(props: IconProps) { } IconRadioActive.displayName = 'IconRadioActive'; - diff --git a/packages/plugin-outline-pane/src/icons/radio.tsx b/packages/plugin-outline-pane/src/icons/radio.tsx index 9bb8fdf6f2..6d7cb35b6e 100644 --- a/packages/plugin-outline-pane/src/icons/radio.tsx +++ b/packages/plugin-outline-pane/src/icons/radio.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconRadio(props: IconProps) { return ( @@ -9,4 +9,3 @@ export function IconRadio(props: IconProps) { } IconRadio.displayName = 'IconRadio'; - diff --git a/packages/plugin-outline-pane/src/icons/setting.tsx b/packages/plugin-outline-pane/src/icons/setting.tsx index a42b0ee013..8bd8ab9b06 100644 --- a/packages/plugin-outline-pane/src/icons/setting.tsx +++ b/packages/plugin-outline-pane/src/icons/setting.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconSetting(props: IconProps) { return ( diff --git a/packages/plugin-outline-pane/src/icons/unlock.tsx b/packages/plugin-outline-pane/src/icons/unlock.tsx index 1f651210f1..c820fd42b2 100644 --- a/packages/plugin-outline-pane/src/icons/unlock.tsx +++ b/packages/plugin-outline-pane/src/icons/unlock.tsx @@ -1,4 +1,4 @@ -import { SVGIcon, IconProps } from '@alilc/lowcode-utils'; +import { SVGIcon, IconProps } from '@felce/lowcode-utils'; export function IconUnlock(props: IconProps) { return ( diff --git a/packages/plugin-outline-pane/src/index.tsx b/packages/plugin-outline-pane/src/index.tsx index 822c503f27..72bb9215bf 100644 --- a/packages/plugin-outline-pane/src/index.tsx +++ b/packages/plugin-outline-pane/src/index.tsx @@ -1,6 +1,6 @@ import { Pane } from './views/pane'; import { IconOutline } from './icons/outline'; -import { IPublicModelPluginContext, IPublicModelDocumentModel } from '@alilc/lowcode-types'; +import { IPublicModelPluginContext, IPublicModelDocumentModel } from '@felce/lowcode-types'; import { MasterPaneName, BackupPaneName } from './helper/consts'; import { TreeMaster } from './controllers/tree-master'; import { PaneController } from './controllers/pane-controller'; diff --git a/packages/plugin-outline-pane/src/views/pane.tsx b/packages/plugin-outline-pane/src/views/pane.tsx index 4b807ca180..003407a9c6 100644 --- a/packages/plugin-outline-pane/src/views/pane.tsx +++ b/packages/plugin-outline-pane/src/views/pane.tsx @@ -6,15 +6,18 @@ import './style.less'; import Filter from './filter'; import { TreeMaster } from '../controllers/tree-master'; import { Tree } from '../controllers/tree'; -import { IPublicTypeDisposable } from '@alilc/lowcode-types'; +import { IPublicTypeDisposable } from '@felce/lowcode-types'; -export class Pane extends PureComponent<{ - treeMaster: TreeMaster; - controller: PaneController; - hideFilter?: boolean; -}, { - tree: Tree | null; -}> { +export class Pane extends PureComponent< + { + treeMaster: TreeMaster; + controller: PaneController; + hideFilter?: boolean; + }, + { + tree: Tree | null; + } +> { private controller; private simulatorRendererReadyDispose: IPublicTypeDisposable; @@ -28,9 +31,14 @@ export class Pane extends PureComponent<{ this.state = { tree: treeMaster.currentTree, }; - this.simulatorRendererReadyDispose = this.props.treeMaster.pluginContext?.project?.onSimulatorRendererReady(this.changeTree); - this.changeDocumentDispose = this.props.treeMaster.pluginContext?.project?.onChangeDocument(this.changeTree); - this.removeDocumentDispose = this.props.treeMaster.pluginContext?.project?.onRemoveDocument(this.changeTree); + this.simulatorRendererReadyDispose = + this.props.treeMaster.pluginContext?.project?.onSimulatorRendererReady(this.changeTree); + this.changeDocumentDispose = this.props.treeMaster.pluginContext?.project?.onChangeDocument( + this.changeTree, + ); + this.removeDocumentDispose = this.props.treeMaster.pluginContext?.project?.onRemoveDocument( + this.changeTree, + ); } changeTree = () => { @@ -67,8 +75,13 @@ export class Pane extends PureComponent<{ return (
- { !this.props.hideFilter && } -
this.controller.mount(shell)} className={`lc-outline-tree-container ${ this.props.hideFilter ? 'lc-hidden-outline-filter' : '' }`}> + {!this.props.hideFilter && } +
this.controller.mount(shell)} + className={`lc-outline-tree-container ${ + this.props.hideFilter ? 'lc-hidden-outline-filter' : '' + }`} + >
diff --git a/packages/plugin-outline-pane/src/views/tree-branches.tsx b/packages/plugin-outline-pane/src/views/tree-branches.tsx index 41bd694812..0457b000bd 100644 --- a/packages/plugin-outline-pane/src/views/tree-branches.tsx +++ b/packages/plugin-outline-pane/src/views/tree-branches.tsx @@ -2,7 +2,11 @@ import { PureComponent } from 'react'; import classNames from 'classnames'; import TreeNode from '../controllers/tree-node'; import TreeNodeView from './tree-node'; -import { IPublicModelExclusiveGroup, IPublicTypeDisposable, IPublicTypeLocationChildrenDetail } from '@alilc/lowcode-types'; +import { + IPublicModelExclusiveGroup, + IPublicTypeDisposable, + IPublicTypeLocationChildrenDetail, +} from '@felce/lowcode-types'; export default class TreeBranches extends PureComponent<{ treeNode: TreeNode; @@ -49,9 +53,7 @@ export default class TreeBranches extends PureComponent<{ return (
- { - !isModal && - } + {!isModal && } { + }, + ITreeNodeChildrenState +> { state: ITreeNodeChildrenState = { filterWorking: false, matchSelf: false, @@ -96,18 +101,16 @@ class TreeNodeChildren extends PureComponent<{ filterWorking: newFilterWorking, matchSelf: newMatchChild, keywords: newKeywords, - } = treeNode.filterReult; + } = treeNode.filterReult; this.setState({ filterWorking: newFilterWorking, matchSelf: newMatchChild, keywords: newKeywords, }); }); - this.offLocationChanged = project.currentDocument?.onDropLocationChanged( - () => { - this.setState({ dropDetail: treeNode.dropDetail }); - }, - ); + this.offLocationChanged = project.currentDocument?.onDropLocationChanged(() => { + this.setState({ dropDetail: treeNode.dropDetail }); + }); } componentWillUnmount(): void { this.offLocationChanged && this.offLocationChanged(); @@ -124,7 +127,11 @@ class TreeNodeChildren extends PureComponent<{ const endGroup = () => { if (groupContents.length > 0) { children.push( -
+
{/* @ts-ignore */} { + treeNode: TreeNode; +}> { render() { const { treeNode } = this.props; if (!treeNode.hasSlots()) { @@ -205,9 +212,11 @@ class TreeNodeSlots extends PureComponent<{ > <div className="tree-node-slots-title"> {/* @ts-ignore */} - <Title title={{ type: 'i18n', intl: this.props.treeNode.pluginContext.intlNode('Slots') }} /> + <Title + title={{ type: 'i18n', intl: this.props.treeNode.pluginContext.intlNode('Slots') }} + /> </div> - {treeNode.slots.map(tnode => ( + {treeNode.slots.map((tnode) => ( <TreeNodeView key={tnode.nodeId} treeNode={tnode} /> ))} </div> diff --git a/packages/plugin-outline-pane/src/views/tree-node.tsx b/packages/plugin-outline-pane/src/views/tree-node.tsx index 11bd95d12f..d0c0856887 100644 --- a/packages/plugin-outline-pane/src/views/tree-node.tsx +++ b/packages/plugin-outline-pane/src/views/tree-node.tsx @@ -4,20 +4,21 @@ import TreeNode from '../controllers/tree-node'; import TreeTitle from './tree-title'; import TreeBranches from './tree-branches'; import { IconEyeClose } from '../icons/eye-close'; -import { IPublicModelModalNodesManager, IPublicTypeDisposable } from '@alilc/lowcode-types'; +import { IPublicModelModalNodesManager, IPublicTypeDisposable } from '@felce/lowcode-types'; import { IOutlinePanelPluginContext } from '../controllers/tree-master'; -class ModalTreeNodeView extends PureComponent<{ - treeNode: TreeNode; -}, { - treeChildren: TreeNode[] | null; -}> { +class ModalTreeNodeView extends PureComponent< + { + treeNode: TreeNode; + }, + { + treeChildren: TreeNode[] | null; + } +> { private modalNodesManager: IPublicModelModalNodesManager | undefined | null; readonly pluginContext: IOutlinePanelPluginContext; - constructor(props: { - treeNode: TreeNode; - }) { + constructor(props: { treeNode: TreeNode }) { super(props); // 模态管理对象 @@ -145,9 +146,9 @@ export default class TreeNodeView extends PureComponent<{ const doc = project.currentDocument; - treeNode.onExpandedChanged(((expanded: boolean) => { + treeNode.onExpandedChanged((expanded: boolean) => { this.setState({ expanded }); - })); + }); treeNode.onHiddenChanged((hidden: boolean) => { this.setState({ hidden }); }); @@ -161,8 +162,16 @@ export default class TreeNodeView extends PureComponent<{ }); }); treeNode.onFilterResultChanged(() => { - const { filterWorking: newFilterWorking, matchChild: newMatchChild, matchSelf: newMatchSelf } = treeNode.filterReult; - this.setState({ filterWorking: newFilterWorking, matchChild: newMatchChild, matchSelf: newMatchSelf }); + const { + filterWorking: newFilterWorking, + matchChild: newMatchChild, + matchSelf: newMatchSelf, + } = treeNode.filterReult; + this.setState({ + filterWorking: newFilterWorking, + matchChild: newMatchChild, + matchSelf: newMatchSelf, + }); }); this.eventOffCallbacks.push( doc?.onDropLocationChanged(() => { @@ -233,10 +242,7 @@ export default class TreeNodeView extends PureComponent<{ return null; } return ( - <div - className={className} - data-id={treeNode.nodeId} - > + <div className={className} data-id={treeNode.nodeId}> <TreeTitle treeNode={treeNode} isModal={isModal} @@ -245,11 +251,7 @@ export default class TreeNodeView extends PureComponent<{ locked={this.state.locked} expandable={this.state.expandable} /> - {shouldShowModalTreeNode && - <ModalTreeNodeView - treeNode={treeNode} - /> - } + {shouldShowModalTreeNode && <ModalTreeNodeView treeNode={treeNode} />} <TreeBranches treeNode={treeNode} isModal={false} diff --git a/packages/plugin-outline-pane/src/views/tree-title.tsx b/packages/plugin-outline-pane/src/views/tree-title.tsx index f822bd644b..262c4f490e 100644 --- a/packages/plugin-outline-pane/src/views/tree-title.tsx +++ b/packages/plugin-outline-pane/src/views/tree-title.tsx @@ -1,15 +1,34 @@ import { KeyboardEvent, FocusEvent, Fragment, PureComponent } from 'react'; import classNames from 'classnames'; -import { createIcon } from '@alilc/lowcode-utils'; -import { IPublicApiEvent } from '@alilc/lowcode-types'; +import { createIcon } from '@felce/lowcode-utils'; +import { IPublicApiEvent } from '@felce/lowcode-types'; import TreeNode from '../controllers/tree-node'; -import { IconLock, IconUnlock, IconArrowRight, IconEyeClose, IconEye, IconCond, IconLoop, IconRadioActive, IconRadio, IconSetting, IconDelete } from '../icons'; +import { + IconLock, + IconUnlock, + IconArrowRight, + IconEyeClose, + IconEye, + IconCond, + IconLoop, + IconRadioActive, + IconRadio, + IconSetting, + IconDelete, +} from '../icons'; -function emitOutlineEvent(event: IPublicApiEvent, type: string, treeNode: TreeNode, rest?: Record<string, unknown>) { +function emitOutlineEvent( + event: IPublicApiEvent, + type: string, + treeNode: TreeNode, + rest?: Record<string, unknown>, +) { const node = treeNode?.node; const npm = node?.componentMeta?.npm; const selected = - [npm?.package, npm?.componentName].filter((item) => !!item).join('-') || node?.componentMeta?.componentName || ''; + [npm?.package, npm?.componentName].filter((item) => !!item).join('-') || + node?.componentMeta?.componentName || + ''; event.emit(`outlinePane.${type}`, { selected, ...rest, @@ -107,8 +126,16 @@ export default class TreeTitle extends PureComponent<{ }); }); treeNode.onFilterResultChanged(() => { - const { filterWorking: newFilterWorking, keywords: newKeywords, matchSelf: newMatchSelf } = treeNode.filterReult; - this.setState({ filterWorking: newFilterWorking, keywords: newKeywords, matchSelf: newMatchSelf }); + const { + filterWorking: newFilterWorking, + keywords: newKeywords, + matchSelf: newMatchSelf, + } = treeNode.filterReult; + this.setState({ + filterWorking: newFilterWorking, + keywords: newKeywords, + matchSelf: newMatchSelf, + }); }); } deleteClick = () => { @@ -123,7 +150,9 @@ export default class TreeTitle extends PureComponent<{ const isCNode = !treeNode.isRoot(); const { node } = treeNode; const { componentMeta } = node; - const availableActions = componentMeta ? componentMeta.availableActions.map((availableAction) => availableAction.name) : []; + const availableActions = componentMeta + ? componentMeta.availableActions.map((availableAction) => availableAction.name) + : []; const isNodeParent = node.isParentalNode; const isContainer = node.isContainerNode; let style: any; @@ -142,7 +171,12 @@ export default class TreeTitle extends PureComponent<{ const couldLock = availableActions.includes('lock'); const couldUnlock = availableActions.includes('unlock'); const shouldShowHideBtn = isCNode && isNodeParent && !isModal && couldHide; - const shouldShowLockBtn = config.get('enableCanvasLock', false) && isContainer && isCNode && isNodeParent && ((couldLock && !node.isLocked) || (couldUnlock && node.isLocked)); + const shouldShowLockBtn = + config.get('enableCanvasLock', false) && + isContainer && + isCNode && + isNodeParent && + ((couldLock && !node.isLocked) || (couldUnlock && node.isLocked)); const shouldEditBtn = isCNode && isNodeParent; const shouldDeleteBtn = isCNode && isNodeParent && node?.canPerformAction('remove'); return ( @@ -165,22 +199,30 @@ export default class TreeTitle extends PureComponent<{ }} > {isModal && this.state.visible && ( - <div onClick={() => { - node.document?.modalNodesManager?.setInvisible(node); - }} + <div + onClick={() => { + node.document?.modalNodesManager?.setInvisible(node); + }} > <IconRadioActive className="tree-node-modal-radio-active" /> </div> )} {isModal && !this.state.visible && ( - <div onClick={() => { - node.document?.modalNodesManager?.setVisible(node); - }} + <div + onClick={() => { + node.document?.modalNodesManager?.setVisible(node); + }} > <IconRadio className="tree-node-modal-radio" /> </div> )} - {isCNode && <ExpandBtn expandable={this.props.expandable} expanded={this.props.expanded} treeNode={treeNode} />} + {isCNode && ( + <ExpandBtn + expandable={this.props.expandable} + expanded={this.props.expanded} + treeNode={treeNode} + /> + )} <div className="tree-node-icon">{createIcon(treeNode.icon)}</div> <div className="tree-node-title-label"> {editing ? ( @@ -243,10 +285,7 @@ class DeleteBtn extends PureComponent<{ const { intl, common } = this.props.treeNode.pluginContext; const { Tip } = common.editorCabin; return ( - <div - className="tree-node-delete-btn" - onClick={this.props.onClick} - > + <div className="tree-node-delete-btn" onClick={this.props.onClick}> <IconDelete /> {/* @ts-ignore */} <Tip>{intl('Delete')}</Tip> @@ -263,10 +302,7 @@ class RenameBtn extends PureComponent<{ const { intl, common } = this.props.treeNode.pluginContext; const { Tip } = common.editorCabin; return ( - <div - className="tree-node-rename-btn" - onClick={this.props.onClick} - > + <div className="tree-node-rename-btn" onClick={this.props.onClick}> <IconSetting /> {/* @ts-ignore */} <Tip>{intl('Rename')}</Tip> @@ -291,7 +327,7 @@ class LockBtn extends PureComponent<{ treeNode.setLocked(!locked); }} > - {locked ? <IconUnlock /> : <IconLock /> } + {locked ? <IconUnlock /> : <IconLock />} {/* @ts-ignore */} <Tip>{locked ? intl('Unlock') : intl('Lock')}</Tip> </div> @@ -299,12 +335,15 @@ class LockBtn extends PureComponent<{ } } -class HideBtn extends PureComponent<{ - treeNode: TreeNode; - hidden: boolean; -}, { - hidden: boolean; -}> { +class HideBtn extends PureComponent< + { + treeNode: TreeNode; + hidden: boolean; + }, + { + hidden: boolean; + } +> { render() { const { treeNode, hidden } = this.props; const { intl, common } = treeNode.pluginContext; @@ -343,7 +382,11 @@ class ExpandBtn extends PureComponent<{ if (expanded) { e.stopPropagation(); } - emitOutlineEvent(treeNode.pluginContext.event, expanded ? 'collapse' : 'expand', treeNode); + emitOutlineEvent( + treeNode.pluginContext.event, + expanded ? 'collapse' : 'expand', + treeNode, + ); treeNode.setExpanded(!expanded); }} > diff --git a/packages/plugin-outline-pane/src/views/tree.tsx b/packages/plugin-outline-pane/src/views/tree.tsx index 8428ec944c..e56d99f3d9 100644 --- a/packages/plugin-outline-pane/src/views/tree.tsx +++ b/packages/plugin-outline-pane/src/views/tree.tsx @@ -1,8 +1,8 @@ import { MouseEvent as ReactMouseEvent, PureComponent } from 'react'; -import { isFormEvent, canClickNode, isShaken } from '@alilc/lowcode-utils'; +import { isFormEvent, canClickNode, isShaken } from '@felce/lowcode-utils'; import { Tree } from '../controllers/tree'; import TreeNodeView from './tree-node'; -import { IPublicEnumDragObjectType, IPublicModelNode } from '@alilc/lowcode-types'; +import { IPublicEnumDragObjectType, IPublicModelNode } from '@felce/lowcode-types'; import TreeNode from '../controllers/tree-node'; function getTreeNodeIdByEvent(e: ReactMouseEvent, stop: Element): null | string { @@ -202,18 +202,16 @@ export default class TreeView extends PureComponent<{ return ( <div className="lc-outline-tree" - ref={(shell) => { this.shell = shell; }} + ref={(shell) => { + this.shell = shell; + }} onMouseDownCapture={this.onMouseDown} onMouseOver={this.onMouseOver} onClick={this.onClick} onDoubleClick={this.onDoubleClick} onMouseLeave={this.onMouseLeave} > - <TreeNodeView - key={this.state.root?.id} - treeNode={this.state.root} - isRootNode - /> + <TreeNodeView key={this.state.root?.id} treeNode={this.state.root} isRootNode /> </div> ); } diff --git a/packages/react-renderer/demo/compose.md b/packages/react-renderer/demo/compose.md index b828cd6041..69187ed0fb 100644 --- a/packages/react-renderer/demo/compose.md +++ b/packages/react-renderer/demo/compose.md @@ -3,10 +3,10 @@ title: 复杂组件 order: 2 --- -````jsx +```jsx import React, { PureComponent } from 'react'; import ReactDOM from 'react-dom'; -import ReactRenderer from '@alilc/lowcode-react-renderer'; +import ReactRenderer from '@felce/lowcode-react-renderer'; import schema from './schemas/compose'; import components from './config/components/index'; import utils from './config/utils'; @@ -23,7 +23,7 @@ class Demo extends PureComponent { components={components} appHelper={{ utils, - constants + constants, }} /> </div> @@ -31,7 +31,5 @@ class Demo extends PureComponent { } } -ReactDOM.render(( - <Demo /> -), mountNode); -```` +ReactDOM.render(<Demo />, mountNode); +``` diff --git a/packages/react-renderer/demo/dataSource.md b/packages/react-renderer/demo/dataSource.md index 5ec00ae8b9..65c4423d91 100644 --- a/packages/react-renderer/demo/dataSource.md +++ b/packages/react-renderer/demo/dataSource.md @@ -3,10 +3,10 @@ title: 数据源使用 order: 4 --- -````jsx +```jsx import React, { PureComponent } from 'react'; import ReactDOM from 'react-dom'; -import ReactRenderer from '@alilc/lowcode-react-renderer'; +import ReactRenderer from '@felce/lowcode-react-renderer'; import schema from './schemas/dataSource'; import components from './config/components/index'; import utils from './config/utils'; @@ -23,7 +23,7 @@ class Demo extends PureComponent { components={components} appHelper={{ utils, - constants + constants, }} /> </div> @@ -31,7 +31,5 @@ class Demo extends PureComponent { } } -ReactDOM.render(( - <Demo /> -), mountNode); -```` +ReactDOM.render(<Demo />, mountNode); +``` diff --git a/packages/react-renderer/demo/i18n.md b/packages/react-renderer/demo/i18n.md index bbea036d19..3c9dc87a03 100644 --- a/packages/react-renderer/demo/i18n.md +++ b/packages/react-renderer/demo/i18n.md @@ -3,10 +3,10 @@ title: 国际化 order: 5 --- -````jsx +```jsx import React, { PureComponent } from 'react'; import ReactDOM from 'react-dom'; -import ReactRenderer from '@alilc/lowcode-react-renderer'; +import ReactRenderer from '@felce/lowcode-react-renderer'; import schema from './schemas/i18n'; import components from './config/components/index'; import utils from './config/utils'; @@ -23,12 +23,12 @@ class Demo extends PureComponent { components={components} appHelper={{ utils, - constants + constants, }} locale="zh-CN" messages={{ - "hello": "你好", - "china": "中国" + hello: '你好', + china: '中国', }} /> </div> @@ -36,7 +36,5 @@ class Demo extends PureComponent { } } -ReactDOM.render(( - <Demo /> -), mountNode); -```` +ReactDOM.render(<Demo />, mountNode); +``` diff --git a/packages/react-renderer/demo/list.md b/packages/react-renderer/demo/list.md index d0e34ee685..8ada2f0128 100644 --- a/packages/react-renderer/demo/list.md +++ b/packages/react-renderer/demo/list.md @@ -3,10 +3,10 @@ title: 列表 order: 1 --- -````jsx +```jsx import React, { PureComponent } from 'react'; import ReactDOM from 'react-dom'; -import ReactRenderer from '@alilc/lowcode-react-renderer'; +import ReactRenderer from '@felce/lowcode-react-renderer'; import schema from './schemas/list'; import components from './config/components/index'; import utils from './config/utils'; @@ -23,7 +23,7 @@ class Demo extends PureComponent { components={components} appHelper={{ utils, - constants + constants, }} /> </div> @@ -31,7 +31,5 @@ class Demo extends PureComponent { } } -ReactDOM.render(( - <Demo /> -), mountNode); -```` +ReactDOM.render(<Demo />, mountNode); +``` diff --git a/packages/react-renderer/demo/table.md b/packages/react-renderer/demo/table.md index 3c7cb307ca..8561f3d2bc 100644 --- a/packages/react-renderer/demo/table.md +++ b/packages/react-renderer/demo/table.md @@ -3,10 +3,10 @@ title: 表格 order: 1 --- -````jsx +```jsx import React, { PureComponent } from 'react'; import ReactDOM from 'react-dom'; -import ReactRenderer from '@alilc/lowcode-react-renderer'; +import ReactRenderer from '@felce/lowcode-react-renderer'; import schema from './schemas/table'; import components from './config/components/index'; import utils from './config/utils'; @@ -23,7 +23,7 @@ class Demo extends PureComponent { components={components} appHelper={{ utils, - constants + constants, }} /> </div> @@ -31,7 +31,5 @@ class Demo extends PureComponent { } } -ReactDOM.render(( - <Demo /> -), mountNode); -```` +ReactDOM.render(<Demo />, mountNode); +``` diff --git a/packages/react-renderer/jest.config.js b/packages/react-renderer/jest.config.js index df1400719b..824b5d5db8 100644 --- a/packages/react-renderer/jest.config.js +++ b/packages/react-renderer/jest.config.js @@ -1,7 +1,7 @@ const fs = require('fs'); const { join } = require('path'); const esModules = [].join('|'); -const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.')); +const pkgNames = fs.readdirSync(join('..')).filter((pkgName) => !pkgName.startsWith('.')); const jestConfig = { // transform: { @@ -13,20 +13,14 @@ const jestConfig = { // testMatch: ['**/designer/builtin-hotkey.test.ts'], // testMatch: ['**/plugin/plugin-manager.test.ts'], // testMatch: ['(/tests?/.*(test))\\.[jt]s$'], - transformIgnorePatterns: [ - `/node_modules/(?!${esModules})/`, - ], + transformIgnorePatterns: [`/node_modules/(?!${esModules})/`], moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], collectCoverage: true, - collectCoverageFrom: [ - 'src/**/*.ts', - '!src/**/*.d.ts', - '!**/node_modules/**', - ], + collectCoverageFrom: ['src/**/*.ts', '!src/**/*.d.ts', '!**/node_modules/**'], }; // 只对本仓库内的 pkg 做 mapping jestConfig.moduleNameMapper = {}; -jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; +jestConfig.moduleNameMapper[`^@felce/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; -module.exports = jestConfig; \ No newline at end of file +module.exports = jestConfig; diff --git a/packages/react-renderer/package.json b/packages/react-renderer/package.json index 625801bc25..ac178de6a6 100644 --- a/packages/react-renderer/package.json +++ b/packages/react-renderer/package.json @@ -1,6 +1,6 @@ { - "name": "@alilc/lowcode-react-renderer", - "version": "1.3.2", + "name": "@felce/lowcode-react-renderer", + "version": "1.4.0", "description": "react renderer for ali lowcode engine", "main": "lib/index.js", "module": "es/index.js", @@ -13,7 +13,7 @@ "test": "build-scripts test --config build.test.json", "start": "build-scripts start", "build": "build-scripts build", - "build:umd": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build --config build.umd.json" + "build:umd": "build-scripts build --config build.umd.json" }, "keywords": [ "lowcode", @@ -21,12 +21,11 @@ "react" ], "dependencies": { - "@alifd/next": "^1.21.16", - "@alilc/lowcode-renderer-core": "1.3.2" + "@alifd/next": "^1.26.0", + "@felce/lowcode-renderer-core": "1.4.0" }, "devDependencies": { "@alib/build-scripts": "^0.1.18", - "@alifd/next": "^1.19.17", "build-plugin-fusion": "^0.1.0", "build-plugin-moment-locales": "^0.1.0", "react": "^16.4.1", @@ -39,9 +38,9 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/react-renderer" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/packages/react-renderer" }, - "homepage": "https://github.com/alibaba/lowcode-engine/#readme", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme", "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues" } diff --git a/packages/react-renderer/src/index.ts b/packages/react-renderer/src/index.ts index d4df733192..30250364b2 100644 --- a/packages/react-renderer/src/index.ts +++ b/packages/react-renderer/src/index.ts @@ -1,4 +1,12 @@ -import React, { Component, PureComponent, createElement, createContext, forwardRef, ReactInstance, ContextType } from 'react'; +import React, { + Component, + PureComponent, + createElement, + createContext, + forwardRef, + ReactInstance, + ContextType, +} from 'react'; import ReactDOM from 'react-dom'; import { adapter, @@ -9,7 +17,7 @@ import { tempRendererFactory, rendererFactory, types, -} from '@alilc/lowcode-renderer-core'; +} from '@felce/lowcode-renderer-core'; import ConfigProvider from '@alifd/next/lib/config-provider'; window.React = React; @@ -42,10 +50,7 @@ function factory(): types.IRenderComponent { context: ContextType<any>; - setState: ( - state: types.IRendererState, - callback?: () => void, - ) => void; + setState: (state: types.IRendererState, callback?: () => void) => void; forceUpdate: (callback?: () => void) => void; diff --git a/packages/react-simulator-renderer/jest.config.js b/packages/react-simulator-renderer/jest.config.js index 5378ef5380..1ef99c8faa 100644 --- a/packages/react-simulator-renderer/jest.config.js +++ b/packages/react-simulator-renderer/jest.config.js @@ -1,7 +1,7 @@ const fs = require('fs'); const { join } = require('path'); const esModules = [].join('|'); -const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.')); +const pkgNames = fs.readdirSync(join('..')).filter((pkgName) => !pkgName.startsWith('.')); const jestConfig = { // transform: { @@ -13,21 +13,15 @@ const jestConfig = { // testMatch: ['**/designer/builtin-hotkey.test.ts'], // testMatch: ['**/plugin/plugin-manager.test.ts'], // testMatch: ['(/tests?/.*(test))\\.[jt]s$'], - transformIgnorePatterns: [ - `/node_modules/(?!${esModules})/`, - ], + transformIgnorePatterns: [`/node_modules/(?!${esModules})/`], setupFiles: ['./test/utils/host.ts'], moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], collectCoverage: true, - collectCoverageFrom: [ - 'src/**/*.ts', - '!src/**/*.d.ts', - '!**/node_modules/**', - ], + collectCoverageFrom: ['src/**/*.ts', '!src/**/*.d.ts', '!**/node_modules/**'], }; // 只对本仓库内的 pkg 做 mapping jestConfig.moduleNameMapper = {}; -jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; +jestConfig.moduleNameMapper[`^@felce/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; -module.exports = jestConfig; \ No newline at end of file +module.exports = jestConfig; diff --git a/packages/react-simulator-renderer/package.json b/packages/react-simulator-renderer/package.json index 3c3950a124..a6bd187309 100644 --- a/packages/react-simulator-renderer/package.json +++ b/packages/react-simulator-renderer/package.json @@ -1,6 +1,6 @@ { - "name": "@alilc/lowcode-react-simulator-renderer", - "version": "1.3.2", + "name": "@felce/lowcode-react-simulator-renderer", + "version": "1.4.0", "description": "react simulator renderer for alibaba lowcode designer", "main": "lib/index.js", "module": "es/index.js", @@ -12,15 +12,15 @@ ], "scripts": { "test": "build-scripts test --config build.test.json", - "build": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build", - "build:umd": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build --config build.umd.json", + "build": "build-scripts build", + "build:umd": "build-scripts build --config build.umd.json", "test:cov": "build-scripts test --config build.test.json --jest-coverage" }, "dependencies": { - "@alilc/lowcode-designer": "1.3.2", - "@alilc/lowcode-react-renderer": "1.3.2", - "@alilc/lowcode-types": "1.3.2", - "@alilc/lowcode-utils": "1.3.2", + "@felce/lowcode-designer": "1.4.0", + "@felce/lowcode-react-renderer": "1.4.0", + "@felce/lowcode-types": "1.4.0", + "@felce/lowcode-utils": "1.4.0", "classnames": "^2.2.6", "mobx": "^6.3.0", "mobx-react": "^7.2.0", @@ -41,9 +41,9 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/react-simulator-renderer" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/packages/react-simulator-renderer" }, "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/packages/react-simulator-renderer/src/host.ts b/packages/react-simulator-renderer/src/host.ts index c5cf2e3e1c..04c6b6f9fd 100644 --- a/packages/react-simulator-renderer/src/host.ts +++ b/packages/react-simulator-renderer/src/host.ts @@ -1,4 +1,4 @@ // NOTE: 仅做类型标注,切勿做其它用途 -import { BuiltinSimulatorHost } from '@alilc/lowcode-designer'; +import { BuiltinSimulatorHost } from '@felce/lowcode-designer'; export const host: BuiltinSimulatorHost = (window as any).LCSimulatorHost; diff --git a/packages/react-simulator-renderer/src/renderer-view.tsx b/packages/react-simulator-renderer/src/renderer-view.tsx index aa1683cd22..64788de5e9 100644 --- a/packages/react-simulator-renderer/src/renderer-view.tsx +++ b/packages/react-simulator-renderer/src/renderer-view.tsx @@ -1,11 +1,11 @@ import { ReactInstance, Fragment, Component, createElement } from 'react'; import { Router, Route, Switch } from 'react-router'; import cn from 'classnames'; -import { Node } from '@alilc/lowcode-designer'; -import LowCodeRenderer from '@alilc/lowcode-react-renderer'; +import { Node } from '@felce/lowcode-designer'; +import LowCodeRenderer from '@felce/lowcode-react-renderer'; import { observer } from 'mobx-react'; -import { getClosestNode, isFromVC, isReactComponent } from '@alilc/lowcode-utils'; -import { GlobalEvent } from '@alilc/lowcode-types'; +import { getClosestNode, isFromVC, isReactComponent } from '@felce/lowcode-utils'; +import { GlobalEvent } from '@felce/lowcode-types'; import { SimulatorRendererContainer, DocumentInstance } from './renderer'; import { host } from './host'; import { isRendererDetached } from './utils/misc'; @@ -14,7 +14,11 @@ import { createIntl } from './locale'; // patch cloneElement avoid lost keyProps const originCloneElement = window.React.cloneElement; -(window as any).React.cloneElement = (child: any, { _leaf, ...props }: any = {}, ...rest: any[]) => { +(window as any).React.cloneElement = ( + child: any, + { _leaf, ...props }: any = {}, + ...rest: any[] +) => { if (child.ref && props.ref) { const dRef = props.ref; const cRef = child.ref; @@ -46,7 +50,9 @@ const originCloneElement = window.React.cloneElement; return originCloneElement(child, props, ...rest); }; -export default class SimulatorRendererView extends Component<{ rendererContainer: SimulatorRendererContainer }> { +export default class SimulatorRendererView extends Component<{ + rendererContainer: SimulatorRendererContainer; +}> { render() { const { rendererContainer } = this.props; return ( @@ -70,7 +76,13 @@ export class Routes extends Component<{ rendererContainer: SimulatorRendererCont <Route path={instance.path} key={instance.id} - render={(routeProps) => <Renderer documentInstance={instance} rendererContainer={rendererContainer} {...routeProps} />} + render={(routeProps) => ( + <Renderer + documentInstance={instance} + rendererContainer={rendererContainer} + {...routeProps} + /> + )} /> ); })} @@ -106,7 +118,11 @@ class Layout extends Component<{ rendererContainer: SimulatorRendererContainer } if (layout) { const { Component, props, componentName } = layout; if (Component) { - return <Component key="layout" props={props}>{children}</Component>; + return ( + <Component key="layout" props={props}> + {children} + </Component> + ); } if (componentName && rendererContainer.getComponent(componentName)) { return createElement( @@ -219,7 +235,10 @@ class Renderer extends Component<{ defaultPlaceholder = intl('Locked elements and child elements cannot be edited'); } children = ( - <div className={cn('lc-container-placeholder', { 'lc-container-locked': !!lockedNode })} style={viewProps.placeholderStyle}> + <div + className={cn('lc-container-placeholder', { 'lc-container-locked': !!lockedNode })} + style={viewProps.placeholderStyle} + > {viewProps.placeholder || defaultPlaceholder} </div> ); @@ -255,7 +274,13 @@ class Renderer extends Component<{ return createElement( getDeviceView(Component, device, designMode), viewProps, - leaf?.isContainer() ? (children == null ? [] : Array.isArray(children) ? children : [children]) : children, + leaf?.isContainer() + ? children == null + ? [] + : Array.isArray(children) + ? children + : [children] + : children, ); }} __host={host} diff --git a/packages/react-simulator-renderer/src/renderer.ts b/packages/react-simulator-renderer/src/renderer.ts index 20f6e18c0b..82ad31b806 100644 --- a/packages/react-simulator-renderer/src/renderer.ts +++ b/packages/react-simulator-renderer/src/renderer.ts @@ -16,11 +16,21 @@ import { isPlainObject, AssetLoader, getProjectUtils, -} from '@alilc/lowcode-utils'; -import { IPublicTypeComponentSchema, IPublicEnumTransformStage, IPublicTypeNodeInstance, IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +} from '@felce/lowcode-utils'; +import { + IPublicTypeComponentSchema, + IPublicEnumTransformStage, + IPublicTypeNodeInstance, + IPublicTypeProjectSchema, +} from '@felce/lowcode-types'; // just use types -import { BuiltinSimulatorRenderer, Component, IDocumentModel, INode } from '@alilc/lowcode-designer'; -import LowCodeRenderer from '@alilc/lowcode-react-renderer'; +import { + BuiltinSimulatorRenderer, + Component, + IDocumentModel, + INode, +} from '@felce/lowcode-designer'; +import LowCodeRenderer from '@felce/lowcode-react-renderer'; import { createMemoryHistory, MemoryHistory } from 'history'; import Slot from './builtin-components/slot'; import Leaf from './builtin-components/leaf'; @@ -94,7 +104,10 @@ export class DocumentInstance { return this.document.id; } - constructor(readonly container: SimulatorRendererContainer, readonly document: IDocumentModel) { + constructor( + readonly container: SimulatorRendererContainer, + readonly document: IDocumentModel, + ) { makeObservable(this); } @@ -170,15 +183,14 @@ export class DocumentInstance { host.setInstance(this.document.id, id, instances); } - mountContext() { - } + mountContext() {} getNode(id: string): INode | null { return this.document.getNode(id); } dispose() { - this.disposeFunctions.forEach(fn => fn()); + this.disposeFunctions.forEach((fn) => fn()); this.instancesMap = new Map(); } } @@ -252,51 +264,57 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer { makeObservable(this); this.autoRender = host.autoRender; - this.disposeFunctions.push(host.connect(this, () => { - // sync layout config - this._layout = host.project.get('config').layout; - - // todo: split with others, not all should recompute - if (this._libraryMap !== host.libraryMap - || this._componentsMap !== host.designer.componentsMap) { - this._libraryMap = host.libraryMap || {}; - this._componentsMap = host.designer.componentsMap; - this.buildComponents(); - } + this.disposeFunctions.push( + host.connect(this, () => { + // sync layout config + this._layout = host.project.get('config').layout; + + // todo: split with others, not all should recompute + if ( + this._libraryMap !== host.libraryMap || + this._componentsMap !== host.designer.componentsMap + ) { + this._libraryMap = host.libraryMap || {}; + this._componentsMap = host.designer.componentsMap; + this.buildComponents(); + } - // sync designMode - this._designMode = host.designMode; + // sync designMode + this._designMode = host.designMode; - this._locale = host.locale; + this._locale = host.locale; - // sync requestHandlersMap - this._requestHandlersMap = host.requestHandlersMap; + // sync requestHandlersMap + this._requestHandlersMap = host.requestHandlersMap; - // sync device - this._device = host.device; - })); + // sync device + this._device = host.device; + }), + ); const documentInstanceMap = new Map<string, DocumentInstance>(); let initialEntry = '/'; let firstRun = true; - this.disposeFunctions.push(host.autorun(() => { - this._documentInstances = host.project.documents.map((doc) => { - let inst = documentInstanceMap.get(doc.id); - if (!inst) { - inst = new DocumentInstance(this, doc); - documentInstanceMap.set(doc.id, inst); + this.disposeFunctions.push( + host.autorun(() => { + this._documentInstances = host.project.documents.map((doc) => { + let inst = documentInstanceMap.get(doc.id); + if (!inst) { + inst = new DocumentInstance(this, doc); + documentInstanceMap.set(doc.id, inst); + } + return inst; + }); + const path = host.project.currentDocument + ? documentInstanceMap.get(host.project.currentDocument.id)!.path + : '/'; + if (firstRun) { + initialEntry = path; + firstRun = false; + } else if (this.history.location.pathname !== path) { + this.history.replace(path); } - return inst; - }); - const path = host.project.currentDocument - ? documentInstanceMap.get(host.project.currentDocument.id)!.path - : '/'; - if (firstRun) { - initialEntry = path; - firstRun = false; - } else if (this.history.location.pathname !== path) { - this.history.replace(path); - } - })); + }), + ); const history = createMemoryHistory({ initialEntries: [initialEntry], }); @@ -361,10 +379,10 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer { private buildComponents() { this._components = buildComponents( - this._libraryMap, - this._componentsMap, - this.createComponent.bind(this), - ); + this._libraryMap, + this._componentsMap, + this.createComponent.bind(this), + ); this._components = { ...builtinComponents, ...this._components, @@ -402,7 +420,10 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer { } } - getClosestNodeInstance(from: ReactInstance, nodeId?: string): IPublicTypeNodeInstance<ReactInstance> | null { + getClosestNodeInstance( + from: ReactInstance, + nodeId?: string, + ): IPublicTypeNodeInstance<ReactInstance> | null { return getClosestNodeInstance(from, nodeId); } @@ -550,9 +571,10 @@ function cacheReactKey(el: Element): Element { return el; } // react17 采用 __reactFiber 开头 - REACT_KEY = Object.keys(el).find( - (key) => key.startsWith('__reactInternalInstance$') || key.startsWith('__reactFiber$'), - ) || ''; + REACT_KEY = + Object.keys(el).find( + (key) => key.startsWith('__reactInternalInstance$') || key.startsWith('__reactFiber$'), + ) || ''; if (!REACT_KEY && (el as HTMLElement).parentElement) { return cacheReactKey((el as HTMLElement).parentElement!); } @@ -563,9 +585,9 @@ const SYMBOL_VNID = Symbol('_LCNodeId'); const SYMBOL_VDID = Symbol('_LCDocId'); function getClosestNodeInstance( - from: ReactInstance, - specId?: string, - ): IPublicTypeNodeInstance<ReactInstance> | null { + from: ReactInstance, + specId?: string, +): IPublicTypeNodeInstance<ReactInstance> | null { let el: any = from; if (el) { if (isElement(el)) { @@ -595,7 +617,10 @@ function getClosestNodeInstance( return null; } -function getNodeInstance(fiberNode: any, specId?: string): IPublicTypeNodeInstance<ReactInstance> | null { +function getNodeInstance( + fiberNode: any, + specId?: string, +): IPublicTypeNodeInstance<ReactInstance> | null { const instance = fiberNode?.stateNode; if (instance && SYMBOL_VNID in instance) { const nodeId = instance[SYMBOL_VNID]; diff --git a/packages/react-simulator-renderer/src/utils/get-client-rects.ts b/packages/react-simulator-renderer/src/utils/get-client-rects.ts index dd13aba81e..d68359cb02 100644 --- a/packages/react-simulator-renderer/src/utils/get-client-rects.ts +++ b/packages/react-simulator-renderer/src/utils/get-client-rects.ts @@ -1,4 +1,4 @@ -import { isElement } from '@alilc/lowcode-utils'; +import { isElement } from '@felce/lowcode-utils'; // a range for test TextNode clientRect const cycleRange = document.createRange(); diff --git a/packages/react-simulator-renderer/src/utils/react-find-dom-nodes.ts b/packages/react-simulator-renderer/src/utils/react-find-dom-nodes.ts index d7af90346f..c28d41916b 100644 --- a/packages/react-simulator-renderer/src/utils/react-find-dom-nodes.ts +++ b/packages/react-simulator-renderer/src/utils/react-find-dom-nodes.ts @@ -1,6 +1,6 @@ import { ReactInstance } from 'react'; import { findDOMNode } from 'react-dom'; -import { isElement } from '@alilc/lowcode-utils'; +import { isElement } from '@felce/lowcode-utils'; import { isDOMNode } from './is-dom-node'; export const getReactInternalFiber = (el: any) => { diff --git a/packages/renderer-core/jest.config.js b/packages/renderer-core/jest.config.js index 1ea4204de5..335d86bb61 100644 --- a/packages/renderer-core/jest.config.js +++ b/packages/renderer-core/jest.config.js @@ -1,7 +1,7 @@ const fs = require('fs'); const { join } = require('path'); const esModules = [].join('|'); -const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.')); +const pkgNames = fs.readdirSync(join('..')).filter((pkgName) => !pkgName.startsWith('.')); const jestConfig = { // transform: { @@ -14,13 +14,8 @@ const jestConfig = { // testMatch: ['**/utils/common.test.ts'], // testMatch: ['**/*/leaf.test.tsx'], // testMatch: ['**/*/is-use-loop.test.ts'], - transformIgnorePatterns: [ - `/node_modules/(?!${esModules})/`, - ], - setupFiles: [ - './tests/fixtures/unhandled-rejection.ts', - './tests/setup.ts', - ], + transformIgnorePatterns: [`/node_modules/(?!${esModules})/`], + setupFiles: ['./tests/fixtures/unhandled-rejection.ts', './tests/setup.ts'], moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], collectCoverage: true, collectCoverageFrom: [ @@ -33,6 +28,6 @@ const jestConfig = { // 只对本仓库内的 pkg 做 mapping jestConfig.moduleNameMapper = {}; -jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; +jestConfig.moduleNameMapper[`^@felce/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; -module.exports = jestConfig; \ No newline at end of file +module.exports = jestConfig; diff --git a/packages/renderer-core/package.json b/packages/renderer-core/package.json index 199eac1cac..9e0b33f1a3 100644 --- a/packages/renderer-core/package.json +++ b/packages/renderer-core/package.json @@ -1,6 +1,6 @@ { - "name": "@alilc/lowcode-renderer-core", - "version": "1.3.2", + "name": "@felce/lowcode-renderer-core", + "version": "1.4.0", "description": "renderer core", "license": "MIT", "main": "lib/index.js", @@ -16,8 +16,8 @@ }, "dependencies": { "@alilc/lowcode-datasource-engine": "^1.0.0", - "@alilc/lowcode-types": "1.3.2", - "@alilc/lowcode-utils": "1.3.2", + "@felce/lowcode-types": "1.4.0", + "@felce/lowcode-utils": "1.4.0", "classnames": "^2.2.6", "debug": "^4.1.1", "fetch-jsonp": "^1.1.3", @@ -32,8 +32,8 @@ "devDependencies": { "@alib/build-scripts": "^0.1.18", "@alifd/next": "^1.26.0", - "@alilc/lowcode-designer": "1.3.2", "@babel/plugin-transform-typescript": "^7.16.8", + "@felce/lowcode-designer": "1.4.0", "@testing-library/react": "^11.2.2", "@types/classnames": "^2.2.11", "@types/debug": "^4.1.5", @@ -53,9 +53,9 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/renderer-core" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/packages/renderer-core" }, "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/packages/renderer-core/src/hoc/index.tsx b/packages/renderer-core/src/hoc/index.tsx index 4851ea486f..8ce673e9c6 100644 --- a/packages/renderer-core/src/hoc/index.tsx +++ b/packages/renderer-core/src/hoc/index.tsx @@ -1,4 +1,4 @@ -import { cloneEnumerableProperty } from '@alilc/lowcode-utils'; +import { cloneEnumerableProperty } from '@felce/lowcode-utils'; import adapter from '../adapter'; import { IBaseRendererInstance, IRendererProps } from '../types'; @@ -14,7 +14,7 @@ function patchDidCatch(Comp: any, { baseRenderer }: Options) { Comp.patchedCatch = true; const { PureComponent } = adapter.getRuntime(); // Rax 的 getDerivedStateFromError 有 BUG,这里先用 componentDidCatch 来替代 - // @see https://github.com/alibaba/rax/issues/2211 + // @see https://github.com/fe-lce/rax/issues/2211 const originalDidCatch = Comp.prototype.componentDidCatch; Comp.prototype.componentDidCatch = function didCatch(this: any, error: Error, errorInfo: any) { this.setState({ engineRenderError: true, error }); diff --git a/packages/renderer-core/src/hoc/leaf.tsx b/packages/renderer-core/src/hoc/leaf.tsx index 2bb3c0b368..ecf8ee8650 100644 --- a/packages/renderer-core/src/hoc/leaf.tsx +++ b/packages/renderer-core/src/hoc/leaf.tsx @@ -1,6 +1,11 @@ -import { INode, IPublicTypePropChangeOptions } from '@alilc/lowcode-designer'; -import { GlobalEvent, IPublicEnumTransformStage, IPublicTypeNodeSchema, IPublicTypeEngineOptions } from '@alilc/lowcode-types'; -import { isReactComponent, cloneEnumerableProperty } from '@alilc/lowcode-utils'; +import { INode, IPublicTypePropChangeOptions } from '@felce/lowcode-designer'; +import { + GlobalEvent, + IPublicEnumTransformStage, + IPublicTypeNodeSchema, + IPublicTypeEngineOptions, +} from '@felce/lowcode-types'; +import { isReactComponent, cloneEnumerableProperty } from '@felce/lowcode-utils'; import { debounce } from '../utils/common'; import adapter from '../adapter'; import * as types from '../types/index'; @@ -40,7 +45,10 @@ export interface IComponentHoc { hoc: IComponentConstruct; } -export type IComponentConstruct = (Comp: types.IBaseRenderComponent, info: IComponentHocInfo) => types.IGeneralConstructor; +export type IComponentConstruct = ( + Comp: types.IBaseRenderComponent, + info: IComponentHocInfo, +) => types.IGeneralConstructor; interface IProps { _leaf: INode | undefined; @@ -66,7 +74,6 @@ enum RerenderType { // 缓存 Leaf 层组件,防止重新渲染问题 class LeafCache { - /** 组件缓存 */ component = new Map(); @@ -82,24 +89,18 @@ class LeafCache { ref = new Map(); - constructor(public documentId: string, public device: string) { - } + constructor( + public documentId: string, + public device: string, + ) {} } let cache: LeafCache; /** 部分没有渲染的 node 节点进行兜底处理 or 渲染方式没有渲染 LeafWrapper */ -function initRerenderEvent({ - schema, - __debug, - container, - getNode, -}: any) { +function initRerenderEvent({ schema, __debug, container, getNode }: any) { const leaf = getNode?.(schema.id); - if (!leaf - || cache.event.get(schema.id)?.clear - || leaf === cache.event.get(schema.id) - ) { + if (!leaf || cache.event.get(schema.id)?.clear || leaf === cache.event.get(schema.id)) { return; } cache.event.get(schema.id)?.dispose.forEach((disposeFn: any) => disposeFn && disposeFn()); @@ -114,21 +115,27 @@ function initRerenderEvent({ if (!container.autoRepaintNode) { return; } - __debug(`${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onPropsChange make rerender`); + __debug( + `${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onPropsChange make rerender`, + ); debounceRerender(); }), leaf?.onChildrenChange?.(() => { if (!container.autoRepaintNode) { return; } - __debug(`${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onChildrenChange make rerender`); + __debug( + `${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onChildrenChange make rerender`, + ); debounceRerender(); }) as Function, leaf?.onVisibleChange?.(() => { if (!container.autoRepaintNode) { return; } - __debug(`${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onVisibleChange make rerender`); + __debug( + `${schema.componentName}[${schema.id}] leaf not render in SimulatorRendererView, leaf onVisibleChange make rerender`, + ); debounceRerender(); }), ], @@ -148,12 +155,10 @@ function clearRerenderEvent(id: string): void { } // 给每个组件包裹一个 HOC Leaf,支持组件内部属性变化,自响应渲染 -export function leafWrapper(Comp: types.IBaseRenderComponent, { - schema, - baseRenderer, - componentInfo, - scope, -}: IComponentHocInfo) { +export function leafWrapper( + Comp: types.IBaseRenderComponent, + { schema, baseRenderer, componentInfo, scope }: IComponentHocInfo, +) { const { __debug, __getComponentProps: getProps, @@ -171,13 +176,18 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { const runtime = adapter.getRuntime(); const { forwardRef, createElement } = runtime; const Component = runtime.Component as types.IGeneralConstructor< - IComponentHocProps, IComponentHocState + IComponentHocProps, + IComponentHocState >; const componentCacheId = schema.id; - if (!cache || (curDocumentId && curDocumentId !== cache.documentId) || (curDevice && curDevice !== cache.device)) { - cache?.event.forEach(event => { + if ( + !cache || + (curDocumentId && curDocumentId !== cache.documentId) || + (curDevice && curDevice !== cache.device) + ) { + cache?.event.forEach((event) => { event.dispose?.forEach((disposeFn: any) => disposeFn && disposeFn()); }); cache = new LeafCache(curDocumentId, curDevice); @@ -194,7 +204,11 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { getNode, }); - if (curDocumentId && cache.component.has(componentCacheId) && (cache.component.get(componentCacheId).Comp === Comp)) { + if ( + curDocumentId && + cache.component.has(componentCacheId) && + cache.component.get(componentCacheId).Comp === Comp + ) { return cache.component.get(componentCacheId).LeafWrapper; } @@ -209,7 +223,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { static displayName = schema.componentName; - disposeFunctions: Array<((() => void) | Function)> = []; + disposeFunctions: Array<(() => void) | Function> = []; __component_tag = 'leafWrapper'; @@ -244,7 +258,9 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { constructor(props: IProps, context: any) { super(props, context); // 监听以下事件,当变化时更新自己 - __debug(`${schema.componentName}[${this.props.componentId}] leaf render in SimulatorRendererView`); + __debug( + `${schema.componentName}[${this.props.componentId}] leaf render in SimulatorRendererView`, + ); clearRerenderEvent(componentCacheId); this.curEventLeaf = this.leaf; @@ -266,7 +282,8 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { } const endTime = Date.now(); const nodeCount = host?.designer?.currentDocument?.getNodeCount?.(); - const componentName = this.recordInfo.node?.componentName || this.leaf?.componentName || 'UnknownComponent'; + const componentName = + this.recordInfo.node?.componentName || this.leaf?.componentName || 'UnknownComponent'; editor?.eventBus.emit(GlobalEvent.Node.Rerender, { componentName, time: endTime - this.recordInfo.startTime, @@ -297,10 +314,8 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { } getDefaultState(nextProps: any) { - const { - hidden = false, - condition = true, - } = nextProps.__inner__ || this.leaf?.export?.(IPublicEnumTransformStage.Render) || {}; + const { hidden = false, condition = true } = + nextProps.__inner__ || this.leaf?.export?.(IPublicEnumTransformStage.Render) || {}; return { nodeChildren: null, childrenInState: false, @@ -348,7 +363,9 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { container?.rerender(); return; } - __debug(`${this.leaf?.componentName}(${this.props.componentId}) need render, make its minimalRenderUnit ${renderUnitInfo.minimalUnitName}(${renderUnitInfo.minimalUnitId})`); + __debug( + `${this.leaf?.componentName}(${this.props.componentId}) need render, make its minimalRenderUnit ${renderUnitInfo.minimalUnitName}(${renderUnitInfo.minimalUnitId})`, + ); ref.makeUnitRender(); } @@ -400,20 +417,14 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { this.curEventLeaf = _leaf; } - const { - visible, - ...resetState - } = this.getDefaultState(nextProps); + const { visible, ...resetState } = this.getDefaultState(nextProps); this.setState(resetState); } /** 监听参数变化 */ initOnPropsChangeEvent(leaf = this.leaf): void { const handlePropsChange = debounce((propChangeInfo: IPublicTypePropChangeOptions) => { - const { - key, - newValue = null, - } = propChangeInfo; + const { key, newValue = null } = propChangeInfo; const node = leaf; if (key === '___condition___') { @@ -439,21 +450,36 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { this.beforeRender(RerenderType.PropsChanged); const { state } = this; const { nodeCacheProps } = state; - const nodeProps = getProps(node?.export?.(IPublicEnumTransformStage.Render) as IPublicTypeNodeSchema, scope, Comp, componentInfo); - if (key && !(key in nodeProps) && (key in this.props)) { + const nodeProps = getProps( + node?.export?.(IPublicEnumTransformStage.Render) as IPublicTypeNodeSchema, + scope, + Comp, + componentInfo, + ); + if (key && !(key in nodeProps) && key in this.props) { // 当 key 在 this.props 中时,且不存在在计算值中,需要用 newValue 覆盖掉 this.props 的取值 nodeCacheProps[key] = newValue; } - __debug(`${leaf?.componentName}[${this.props.componentId}] component trigger onPropsChange!`, nodeProps, nodeCacheProps, key, newValue); - this.setState('children' in nodeProps ? { - nodeChildren: nodeProps.children, - nodeProps, - childrenInState: true, - nodeCacheProps, - } : { + __debug( + `${leaf?.componentName}[${this.props.componentId}] component trigger onPropsChange!`, nodeProps, nodeCacheProps, - }); + key, + newValue, + ); + this.setState( + 'children' in nodeProps + ? { + nodeChildren: nodeProps.children, + nodeProps, + childrenInState: true, + nodeCacheProps, + } + : { + nodeProps, + nodeCacheProps, + }, + ); this.judgeMiniUnitRender(); }); @@ -479,7 +505,9 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { return; } - __debug(`${leaf?.componentName}[${this.props.componentId}] component trigger onVisibleChange(${flag}) event`); + __debug( + `${leaf?.componentName}[${this.props.componentId}] component trigger onVisibleChange(${flag}) event`, + ); this.beforeRender(RerenderType.VisibleChanged); this.setState({ visible: flag, @@ -498,16 +526,20 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { if (!this.autoRepaintNode) { return; } - const { - type, - node, - } = param || {}; + const { type, node } = param || {}; this.beforeRender(`${RerenderType.ChildChanged}-${type}`, node); // TODO: 缓存同级其他元素的 children。 // 缓存二级 children Next 查询筛选组件有问题 // 缓存一级 children Next Tab 组件有问题 - const nextChild = getChildren(leaf?.export?.(IPublicEnumTransformStage.Render) as types.ISchema, scope, Comp); - __debug(`${schema.componentName}[${this.props.componentId}] component trigger onChildrenChange event`, nextChild); + const nextChild = getChildren( + leaf?.export?.(IPublicEnumTransformStage.Render) as types.ISchema, + scope, + Comp, + ); + __debug( + `${schema.componentName}[${this.props.componentId}] component trigger onChildrenChange event`, + nextChild, + ); this.setState({ nodeChildren: nextChild, childrenInState: true, @@ -518,7 +550,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { } componentWillUnmount() { - this.disposeFunctions.forEach(fn => fn()); + this.disposeFunctions.forEach((fn) => fn()); } get hasChildren(): boolean { @@ -556,10 +588,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { return null; } - const { - forwardedRef, - ...rest - } = this.props; + const { forwardedRef, ...rest } = this.props; const compProps = { ...rest, @@ -597,4 +626,4 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, { }); return LeafWrapper; -} \ No newline at end of file +} diff --git a/packages/renderer-core/src/renderer/base.tsx b/packages/renderer-core/src/renderer/base.tsx index d240095604..ba377acbf7 100644 --- a/packages/renderer-core/src/renderer/base.tsx +++ b/packages/renderer-core/src/renderer/base.tsx @@ -3,8 +3,13 @@ /* eslint-disable react/prop-types */ import classnames from 'classnames'; import { create as createDataSourceEngine } from '@alilc/lowcode-datasource-engine/interpret'; -import { IPublicTypeNodeSchema, IPublicTypeNodeData, IPublicTypeJSONValue, IPublicTypeCompositeValue } from '@alilc/lowcode-types'; -import { checkPropTypes, isI18nData, isJSExpression, isJSFunction } from '@alilc/lowcode-utils'; +import { + IPublicTypeNodeSchema, + IPublicTypeNodeData, + IPublicTypeJSONValue, + IPublicTypeCompositeValue, +} from '@felce/lowcode-types'; +import { checkPropTypes, isI18nData, isJSExpression, isJSFunction } from '@felce/lowcode-utils'; import adapter from '../adapter'; import divFactory from '../components/Div'; import visualDomFactory from '../components/VisualDom'; @@ -28,7 +33,14 @@ import { isVariable, isJSSlot, } from '../utils'; -import { IBaseRendererProps, INodeInfo, IBaseRenderComponent, IBaseRendererContext, IRendererAppHelper, DataSource } from '../types'; +import { + IBaseRendererProps, + INodeInfo, + IBaseRenderComponent, + IBaseRendererContext, + IRendererAppHelper, + DataSource, +} from '../types'; import { compWrapper } from '../hoc'; import { IComponentConstruct, leafWrapper } from '../hoc/leaf'; import logger from '../utils/logger'; @@ -38,7 +50,13 @@ import isUseLoop from '../utils/is-use-loop'; * execute method in schema.lifeCycles with context * @PRIVATE */ -export function executeLifeCycleMethod(context: any, schema: IPublicTypeNodeSchema, method: string, args: any, thisRequiredInJSE: boolean | undefined): any { +export function executeLifeCycleMethod( + context: any, + schema: IPublicTypeNodeSchema, + method: string, + args: any, + thisRequiredInJSE: boolean | undefined, +): any { if (!context || !isSchema(schema) || !method) { return; } @@ -51,7 +69,9 @@ export function executeLifeCycleMethod(context: any, schema: IPublicTypeNodeSche // TODO: cache if (isJSExpression(fn) || isJSFunction(fn)) { - fn = thisRequiredInJSE ? parseThisRequiredExpression(fn, context) : parseExpression(fn, context); + fn = thisRequiredInJSE + ? parseThisRequiredExpression(fn, context) + : parseExpression(fn, context); } if (typeof fn !== 'function') { @@ -159,7 +179,12 @@ export default function baseRendererFactory(): IBaseRenderComponent { super(props, context); this.context = context; this.__parseExpression = (str: string, self: any) => { - return parseExpression({ str, self, thisRequired: props?.thisRequiredInJSE, logScope: props.componentName }); + return parseExpression({ + str, + self, + thisRequired: props?.thisRequiredInJSE, + logScope: props.componentName, + }); }; this.__beforeInit(props); this.__init(props); @@ -168,7 +193,7 @@ export default function baseRendererFactory(): IBaseRenderComponent { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - __beforeInit(_props: IBaseRendererProps) { } + __beforeInit(_props: IBaseRendererProps) {} __init(props: IBaseRendererProps) { this.__compScopes = {}; @@ -178,10 +203,16 @@ export default function baseRendererFactory(): IBaseRenderComponent { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - __afterInit(_props: IBaseRendererProps) { } + __afterInit(_props: IBaseRendererProps) {} static getDerivedStateFromProps(props: IBaseRendererProps, state: any) { - const result = executeLifeCycleMethod(this, props?.__schema, 'getDerivedStateFromProps', [props, state], props.thisRequiredInJSE); + const result = executeLifeCycleMethod( + this, + props?.__schema, + 'getDerivedStateFromProps', + [props, state], + props.thisRequiredInJSE, + ); return result === undefined ? null : result; } @@ -211,23 +242,25 @@ export default function baseRendererFactory(): IBaseRenderComponent { logger.warn(args); } - reloadDataSource = () => new Promise((resolve, reject) => { - this.__debug('reload data source'); - if (!this.__dataHelper) { - return resolve({}); - } - this.__dataHelper.getInitData() - .then((res: any) => { - if (isEmpty(res)) { - this.forceUpdate(); - return resolve({}); - } - this.setState(res, resolve as () => void); - }) - .catch((err: Error) => { - reject(err); - }); - }); + reloadDataSource = () => + new Promise((resolve, reject) => { + this.__debug('reload data source'); + if (!this.__dataHelper) { + return resolve({}); + } + this.__dataHelper + .getInitData() + .then((res: any) => { + if (isEmpty(res)) { + this.forceUpdate(); + return resolve({}); + } + this.setState(res, resolve as () => void); + }) + .catch((err: Error) => { + reject(err); + }); + }); shouldComponentUpdate() { if (this.props.getSchemaChangedSymbol?.() && this.props.__container?.rerender) { @@ -313,46 +346,53 @@ export default function baseRendererFactory(): IBaseRenderComponent { const dataSource = schema.dataSource || defaultDataSource; // requestHandlersMap 存在才走数据源引擎方案 // TODO: 下面if else 抽成独立函数 - const useDataSourceEngine = !!(props.__appHelper?.requestHandlersMap); + const useDataSourceEngine = !!props.__appHelper?.requestHandlersMap; if (useDataSourceEngine) { this.__dataHelper = { updateConfig: (updateDataSource: any) => { const { dataSourceMap, reloadDataSource } = createDataSourceEngine( updateDataSource ?? {}, this, - props.__appHelper.requestHandlersMap ? { requestHandlersMap: props.__appHelper.requestHandlersMap } : undefined, + props.__appHelper.requestHandlersMap + ? { requestHandlersMap: props.__appHelper.requestHandlersMap } + : undefined, ); - this.reloadDataSource = () => new Promise((resolve) => { - this.__debug('reload data source'); - reloadDataSource().then(() => { - resolve({}); + this.reloadDataSource = () => + new Promise((resolve) => { + this.__debug('reload data source'); + reloadDataSource().then(() => { + resolve({}); + }); }); - }); return dataSourceMap; }, }; this.dataSourceMap = this.__dataHelper.updateConfig(dataSource); } else { const appHelper = props.__appHelper; - this.__dataHelper = new DataHelper(this, dataSource, appHelper, (config: any) => this.__parseData(config)); + this.__dataHelper = new DataHelper(this, dataSource, appHelper, (config: any) => + this.__parseData(config), + ); this.dataSourceMap = this.__dataHelper.dataSourceMap; - this.reloadDataSource = () => new Promise((resolve, reject) => { - this.__debug('reload data source'); - if (!this.__dataHelper) { - return resolve({}); - } - this.__dataHelper.getInitData() - .then((res: any) => { - if (isEmpty(res)) { - return resolve({}); - } - this.setState(res, resolve as () => void); - }) - .catch((err: Error) => { - reject(err); - }); - }); + this.reloadDataSource = () => + new Promise((resolve, reject) => { + this.__debug('reload data source'); + if (!this.__dataHelper) { + return resolve({}); + } + this.__dataHelper + .getInitData() + .then((res: any) => { + if (isEmpty(res)) { + return resolve({}); + } + this.setState(res, resolve as () => void); + }) + .catch((err: Error) => { + reject(err); + }); + }); } }; @@ -369,7 +409,9 @@ export default function baseRendererFactory(): IBaseRenderComponent { this.setLocale = (loc: string) => { const setLocaleFn = this.appHelper?.utils?.i18n?.setLocale; if (!setLocaleFn || typeof setLocaleFn !== 'function') { - logger.warn('initI18nAPIs Failed, i18n only works when appHelper.utils.i18n.setLocale() exists'); + logger.warn( + 'initI18nAPIs Failed, i18n only works when appHelper.utils.i18n.setLocale() exists', + ); return undefined; } return setLocaleFn(loc); @@ -444,10 +486,10 @@ export default function baseRendererFactory(): IBaseRenderComponent { if (!Comp) { this.__debug(`${__schema.componentName} is invalid!`); } - const parentNodeInfo = ({ + const parentNodeInfo = { schema: __schema, Comp: this.__getHOCWrappedComponent(Comp, __schema, scope), - } as INodeInfo); + } as INodeInfo; return this.__createVirtualDom(_children, scope, parentNodeInfo); }; @@ -458,7 +500,12 @@ export default function baseRendererFactory(): IBaseRenderComponent { * @param parentInfo 父组件的信息,包含schema和Comp * @param idx 为循环渲染的循环Index */ - __createVirtualDom = (originalSchema: IPublicTypeNodeData | IPublicTypeNodeData[] | undefined, originalScope: any, parentInfo: INodeInfo, idx: string | number = ''): any => { + __createVirtualDom = ( + originalSchema: IPublicTypeNodeData | IPublicTypeNodeData[] | undefined, + originalScope: any, + parentInfo: INodeInfo, + idx: string | number = '', + ): any => { if (originalSchema === null || originalSchema === undefined) { return null; } @@ -494,7 +541,14 @@ export default function baseRendererFactory(): IBaseRenderComponent { if (schema.length === 1) { return this.__createVirtualDom(schema[0], scope, parentInfo); } - return schema.map((item, idy) => this.__createVirtualDom(item, scope, parentInfo, (item as IPublicTypeNodeSchema)?.__ctx?.lceKey ? '' : String(idy))); + return schema.map((item, idy) => + this.__createVirtualDom( + item, + scope, + parentInfo, + (item as IPublicTypeNodeSchema)?.__ctx?.lceKey ? '' : String(idy), + ), + ); } // @ts-expect-error 如果直接转换好了,可以返回 @@ -504,12 +558,17 @@ export default function baseRendererFactory(): IBaseRenderComponent { const _children = getSchemaChildren(schema); if (!schema.componentName) { - logger.error('The componentName in the schema is invalid, please check the schema: ', schema); + logger.error( + 'The componentName in the schema is invalid, please check the schema: ', + schema, + ); return; } // 解析占位组件 if (schema.componentName === 'Fragment' && _children) { - const tarChildren = isJSExpression(_children) ? this.__parseExpression(_children, scope) : _children; + const tarChildren = isJSExpression(_children) + ? this.__parseExpression(_children, scope) + : _children; return this.__createVirtualDom(tarChildren, scope, parentInfo); } @@ -522,19 +581,24 @@ export default function baseRendererFactory(): IBaseRenderComponent { if (!isSchema(schema)) { return null; } - let Comp = components[schema.componentName] || this.props.__container?.components?.[schema.componentName]; + let Comp = + components[schema.componentName] || + this.props.__container?.components?.[schema.componentName]; // 容器类组件的上下文通过props传递,避免context传递带来的嵌套问题 const otherProps: any = isFileSchema(schema) ? { - __schema: schema, - __appHelper: appHelper, - __components: components, - } + __schema: schema, + __appHelper: appHelper, + __components: components, + } : {}; if (!Comp) { - logger.error(`${schema.componentName} component is not found in components list! component list is:`, components || this.props.__container?.components); + logger.error( + `${schema.componentName} component is not found in components list! component list is:`, + components || this.props.__container?.components, + ); return engine.createElement( engine.getNotFoundComponent(), { @@ -565,7 +629,8 @@ export default function baseRendererFactory(): IBaseRenderComponent { ); } } - const condition = schema.condition == null ? true : this.__parseData(schema.condition, scope); + const condition = + schema.condition == null ? true : this.__parseData(schema.condition, scope); // DesignMode 为 design 情况下,需要进入 leaf Hoc,进行相关事件注册 const displayInHook = this.__designModeIsDesign; @@ -608,10 +673,11 @@ export default function baseRendererFactory(): IBaseRenderComponent { otherProps.__tag = Math.random(); } const componentInfo: any = {}; - const props: any = this.__getComponentProps(schema, scope, Comp, { - ...componentInfo, - props: transformArrayToMap(componentInfo.props, 'name'), - }) || {}; + const props: any = + this.__getComponentProps(schema, scope, Comp, { + ...componentInfo, + props: transformArrayToMap(componentInfo.props, 'name'), + }) || {}; this.__componentHOCs.forEach((ComponentConstruct: IComponentConstruct) => { Comp = ComponentConstruct(Comp, { @@ -639,7 +705,9 @@ export default function baseRendererFactory(): IBaseRenderComponent { if (!isFileSchema(schema)) { engine.props?.onCompGetCtx(schema, scope); } - props.key = props.key || `${schema.__ctx.lceKey}_${schema.__ctx.idx || 0}_${idx !== undefined ? idx : ''}`; + props.key = + props.key || + `${schema.__ctx.lceKey}_${schema.__ctx.idx || 0}_${idx !== undefined ? idx : ''}`; } else if ((typeof idx === 'number' || typeof idx === 'string') && !props.key) { // 仅当循环场景走这里 props.key = idx; @@ -657,10 +725,14 @@ export default function baseRendererFactory(): IBaseRenderComponent { // 对于overlay,dialog等组件为了使其在设计模式下显示,外层需要增加一个div容器 if (OVERLAY_LIST.includes(schema.componentName)) { const { ref, ...overlayProps } = otherProps; - return createElement(Div, { - ref, - __designMode: engine.props.designMode, - }, renderComp({ ...props, ...overlayProps })); + return createElement( + Div, + { + ref, + __designMode: engine.props.designMode, + }, + renderComp({ ...props, ...overlayProps }), + ); } // 虚拟dom显示 if (componentInfo?.parentRule) { @@ -710,7 +782,12 @@ export default function baseRendererFactory(): IBaseRenderComponent { return [compWrapper]; } - __getSchemaChildrenVirtualDom = (schema: IPublicTypeNodeSchema | undefined, scope: any, Comp: any, condition = true) => { + __getSchemaChildrenVirtualDom = ( + schema: IPublicTypeNodeSchema | undefined, + scope: any, + Comp: any, + condition = true, + ) => { let children = condition ? getSchemaChildren(schema) : null; // @todo 补完这里的 Element 定义 @承虎 @@ -740,21 +817,33 @@ export default function baseRendererFactory(): IBaseRenderComponent { return null; }; - __getComponentProps = (schema: IPublicTypeNodeSchema | undefined, scope: any, Comp: any, componentInfo?: any) => { + __getComponentProps = ( + schema: IPublicTypeNodeSchema | undefined, + scope: any, + Comp: any, + componentInfo?: any, + ) => { if (!schema) { return {}; } - return this.__parseProps(schema?.props, scope, '', { - schema, - Comp, - componentInfo: { - ...(componentInfo || {}), - props: transformArrayToMap((componentInfo || {}).props, 'name'), - }, - }) || {}; + return ( + this.__parseProps(schema?.props, scope, '', { + schema, + Comp, + componentInfo: { + ...(componentInfo || {}), + props: transformArrayToMap((componentInfo || {}).props, 'name'), + }, + }) || {} + ); }; - __createLoopVirtualDom = (schema: IPublicTypeNodeSchema, scope: any, parentInfo: INodeInfo, idx: number | string) => { + __createLoopVirtualDom = ( + schema: IPublicTypeNodeSchema, + scope: any, + parentInfo: INodeInfo, + idx: number | string, + ) => { if (isFileSchema(schema)) { logger.warn('file type not support Loop'); return null; @@ -809,7 +898,7 @@ export default function baseRendererFactory(): IBaseRenderComponent { const parseReactNode = (data: any, params: any) => { if (isEmpty(params)) { - const virtualDom = this.__createVirtualDom(data, scope, ({ schema, Comp } as INodeInfo)); + const virtualDom = this.__createVirtualDom(data, scope, { schema, Comp } as INodeInfo); return checkProps(virtualDom); } return checkProps((...argValues: any[]) => { @@ -824,7 +913,7 @@ export default function baseRendererFactory(): IBaseRenderComponent { }); } args.__proto__ = scope; - return scope.__createVirtualDom(data, args, ({ schema, Comp } as INodeInfo)); + return scope.__createVirtualDom(data, args, { schema, Comp } as INodeInfo); }); }; @@ -836,7 +925,8 @@ export default function baseRendererFactory(): IBaseRenderComponent { } } - const handleI18nData = (innerProps: any) => innerProps[innerProps.use || (this.getLocale && this.getLocale()) || 'zh-CN']; + const handleI18nData = (innerProps: any) => + innerProps[innerProps.use || (this.getLocale && this.getLocale()) || 'zh-CN']; // @LEGACY 兼容老平台设计态 i18n 数据 if (isI18nData(props)) { @@ -869,12 +959,14 @@ export default function baseRendererFactory(): IBaseRenderComponent { // 兼容通过componentInfo判断的情况 if (isSchema(props)) { - const isReactNodeFunction = !!(propInfo?.type === 'ReactNode' && propInfo?.props?.type === 'function'); + const isReactNodeFunction = !!( + propInfo?.type === 'ReactNode' && propInfo?.props?.type === 'function' + ); const isMixinReactNodeFunction = !!( - propInfo?.type === 'Mixin' - && propInfo?.props?.types?.indexOf('ReactNode') > -1 - && propInfo?.props?.reactNodeProps?.type === 'function' + propInfo?.type === 'Mixin' && + propInfo?.props?.types?.indexOf('ReactNode') > -1 && + propInfo?.props?.reactNodeProps?.type === 'function' ); let params = null; @@ -883,13 +975,14 @@ export default function baseRendererFactory(): IBaseRenderComponent { } else if (isMixinReactNodeFunction) { params = propInfo?.props?.reactNodeProps?.params; } - return parseReactNode( - props, - params, - ); + return parseReactNode(props, params); } if (Array.isArray(props)) { - return checkProps(props.map((item, idx) => this.__parseProps(item, scope, path ? `${path}.${idx}` : `${idx}`, info))); + return checkProps( + props.map((item, idx) => + this.__parseProps(item, scope, path ? `${path}.${idx}` : `${idx}`, info), + ), + ); } if (typeof props === 'function') { return checkProps(props.bind(scope)); @@ -922,7 +1015,9 @@ export default function baseRendererFactory(): IBaseRenderComponent { return this.__instanceMap[filedId]; } - __debug = (...args: any[]) => { logger.debug(...args); }; + __debug = (...args: any[]) => { + logger.debug(...args); + }; __renderContextProvider = (customProps?: object, children?: any) => { return createElement(AppContext.Provider, { @@ -981,7 +1076,11 @@ export default function baseRendererFactory(): IBaseRenderComponent { ...data, ...this.props, ref: this.__getRef, - className: classnames(getFileCssName(__schema?.fileName), className, this.props.className), + className: classnames( + getFileCssName(__schema?.fileName), + className, + this.props.className, + ), __id: __schema?.id, ...otherProps, }, @@ -993,18 +1092,33 @@ export default function baseRendererFactory(): IBaseRenderComponent { __renderContent(children: any) { const { __schema } = this.props; const parsedProps = this.__parseData(__schema.props); - const className = classnames(`lce-${this.__namespace}`, getFileCssName(__schema.fileName), parsedProps.className, this.props.className); - const style = { ...(parsedProps.style || {}), ...(typeof this.props.style === 'object' ? this.props.style : {}) }; + const className = classnames( + `lce-${this.__namespace}`, + getFileCssName(__schema.fileName), + parsedProps.className, + this.props.className, + ); + const style = { + ...(parsedProps.style || {}), + ...(typeof this.props.style === 'object' ? this.props.style : {}), + }; const id = this.props.id || parsedProps.id; - return createElement('div', { - ref: this.__getRef, - className, - id, - style, - }, children); + return createElement( + 'div', + { + ref: this.__getRef, + className, + id, + style, + }, + children, + ); } - __checkSchema = (schema: IPublicTypeNodeSchema | undefined, originalExtraComponents: string | string[] = []) => { + __checkSchema = ( + schema: IPublicTypeNodeSchema | undefined, + originalExtraComponents: string | string[] = [], + ) => { let extraComponents = originalExtraComponents; if (typeof extraComponents === 'string') { extraComponents = [extraComponents]; diff --git a/packages/renderer-core/src/renderer/page.tsx b/packages/renderer-core/src/renderer/page.tsx index 16d55e01be..cd0e3d2dfa 100644 --- a/packages/renderer-core/src/renderer/page.tsx +++ b/packages/renderer-core/src/renderer/page.tsx @@ -1,4 +1,4 @@ -import { getLogger } from '@alilc/lowcode-utils'; +import { getLogger } from '@felce/lowcode-utils'; import baseRendererFactory from './base'; import { IBaseRendererProps, IBaseRenderComponent } from '../types'; diff --git a/packages/renderer-core/src/renderer/renderer.tsx b/packages/renderer-core/src/renderer/renderer.tsx index 300b1cd164..497f9e757e 100644 --- a/packages/renderer-core/src/renderer/renderer.tsx +++ b/packages/renderer-core/src/renderer/renderer.tsx @@ -5,7 +5,7 @@ import { isFileSchema, isEmpty } from '../utils'; import baseRendererFactory from './base'; import divFactory from '../components/Div'; import { IRenderComponent, IRendererProps, IRendererState } from '../types'; -import { IPublicTypeNodeSchema, IPublicTypeRootSchema } from '@alilc/lowcode-types'; +import { IPublicTypeNodeSchema, IPublicTypeRootSchema } from '@felce/lowcode-types'; import logger from '../utils/logger'; export default function rendererFactory(): IRenderComponent { @@ -21,29 +21,44 @@ export default function rendererFactory(): IRenderComponent { class FaultComponent extends PureComponent<IPublicTypeNodeSchema | any> { render() { - logger.error(`%c${this.props.componentName || ''} 组件渲染异常, 异常原因: ${this.props.error?.message || this.props.error || '未知'}`, 'color: #ff0000;'); - return createElement(Div, { - style: { - width: '100%', - height: '50px', - lineHeight: '50px', - textAlign: 'center', - fontSize: '15px', - color: '#ff0000', - border: '2px solid #ff0000', + logger.error( + `%c${this.props.componentName || ''} 组件渲染异常, 异常原因: ${ + this.props.error?.message || this.props.error || '未知' + }`, + 'color: #ff0000;', + ); + return createElement( + Div, + { + style: { + width: '100%', + height: '50px', + lineHeight: '50px', + textAlign: 'center', + fontSize: '15px', + color: '#ff0000', + border: '2px solid #ff0000', + }, }, - }, `${this.props.componentName || ''} 组件渲染异常,请查看控制台日志`); + `${this.props.componentName || ''} 组件渲染异常,请查看控制台日志`, + ); } } - class NotFoundComponent extends PureComponent<{ - componentName: string; - } & IRendererProps> { + class NotFoundComponent extends PureComponent< + { + componentName: string; + } & IRendererProps + > { render() { if (this.props.enableStrictNotFoundMode) { return `${this.props.componentName || ''} Component Not Found`; } - return createElement(Div, this.props, this.props.children || `${this.props.componentName || ''} Component Not Found`); + return createElement( + Div, + this.props, + this.props.children || `${this.props.componentName || ''} Component Not Found`, + ); } } @@ -60,8 +75,8 @@ export default function rendererFactory(): IRenderComponent { designMode: '', suspended: false, schema: {} as IPublicTypeRootSchema, - onCompGetRef: () => { }, - onCompGetCtx: () => { }, + onCompGetRef: () => {}, + onCompGetCtx: () => {}, thisRequiredInJSE: true, }; @@ -142,7 +157,10 @@ export default function rendererFactory(): IRenderComponent { } // 兼容乐高区块模板 if (schema.componentName !== 'Div' && !isFileSchema(schema)) { - logger.error('The root component name needs to be one of Page、Block、Component, please check the schema: ', schema); + logger.error( + 'The root component name needs to be one of Page、Block、Component, please check the schema: ', + schema, + ); return '模型结构异常'; } debug('entry.render'); @@ -157,24 +175,32 @@ export default function rendererFactory(): IRenderComponent { } if (Comp) { - return createElement(AppContext.Provider, { - value: { - appHelper, - components: allComponents, - engine: this, + return createElement( + AppContext.Provider, + { + value: { + appHelper, + components: allComponents, + engine: this, + }, }, - }, createElement(ConfigProvider, { - device: this.props.device, - locale: this.props.locale, - }, createElement(Comp, { - key: schema.__ctx && `${schema.__ctx.lceKey}_${schema.__ctx.idx || '0'}`, - ref: this.__getRef, - __appHelper: appHelper, - __components: allComponents, - __schema: schema, - __designMode: designMode, - ...this.props, - }))); + createElement( + ConfigProvider, + { + device: this.props.device, + locale: this.props.locale, + }, + createElement(Comp, { + key: schema.__ctx && `${schema.__ctx.lceKey}_${schema.__ctx.idx || '0'}`, + ref: this.__getRef, + __appHelper: appHelper, + __components: allComponents, + __schema: schema, + __designMode: designMode, + ...this.props, + }), + ), + ); } return null; } diff --git a/packages/renderer-core/src/types/index.ts b/packages/renderer-core/src/types/index.ts index afbec272ab..7a8e23f4ee 100644 --- a/packages/renderer-core/src/types/index.ts +++ b/packages/renderer-core/src/types/index.ts @@ -1,6 +1,11 @@ import type { ComponentLifecycle, CSSProperties } from 'react'; -import { BuiltinSimulatorHost, BuiltinSimulatorRenderer } from '@alilc/lowcode-designer'; -import { RequestHandler, IPublicTypeNodeSchema, IPublicTypeRootSchema, IPublicTypeJSONObject } from '@alilc/lowcode-types'; +import { BuiltinSimulatorHost, BuiltinSimulatorRenderer } from '@felce/lowcode-designer'; +import { + RequestHandler, + IPublicTypeNodeSchema, + IPublicTypeRootSchema, + IPublicTypeJSONObject, +} from '@felce/lowcode-types'; export type ISchema = IPublicTypeNodeSchema | IPublicTypeRootSchema; @@ -13,8 +18,10 @@ interface IGeneralComponent<P = {}, S = {}, SS = any> extends ComponentLifecycle refs: Record<string, any>; context: any; setState<K extends keyof S>( - state: ((prevState: Readonly<S>, props: Readonly<P>) => (Pick<S, K> | S | null)) | (Pick<S, K> | S | null), - callback?: () => void + state: + | ((prevState: Readonly<S>, props: Readonly<P>) => Pick<S, K> | S | null) + | (Pick<S, K> | S | null), + callback?: () => void, ): void; forceUpdate(callback?: () => void): void; render(): any; @@ -23,9 +30,11 @@ interface IGeneralComponent<P = {}, S = {}, SS = any> extends ComponentLifecycle export type IGeneralConstructor< T = { [key: string]: any; - }, S = { + }, + S = { [key: string]: any; - }, D = any + }, + D = any, > = new <TT = T, SS = S, DD = D>(props: TT, context: any) => IGeneralComponent<TT, SS, DD>; /** @@ -60,7 +69,6 @@ export interface ILocationLike { } export type IRendererAppHelper = Partial<{ - /** 全局公共函数 */ utils: Record<string, any>; @@ -83,9 +91,12 @@ export type IRendererAppHelper = Partial<{ addons: Record<string, any>; /** @experimental 内部使用 */ - requestHandlersMap: Record<string, RequestHandler<{ - data: unknown; - }>>; + requestHandlersMap: Record< + string, + RequestHandler<{ + data: unknown; + }> + >; }>; /** @@ -94,7 +105,6 @@ export type IRendererAppHelper = Partial<{ * @see @todo @承虎 */ export interface IRendererProps { - /** 符合低代码搭建协议的数据 */ schema: IPublicTypeRootSchema | IPublicTypeNodeSchema; @@ -281,44 +291,48 @@ export type IBaseRendererInstance = IGeneralComponent< IBaseRendererProps, Record<string, any>, any -> - & { - reloadDataSource(): Promise<any>; - __beforeInit(props: IBaseRendererProps): void; - __init(props: IBaseRendererProps): void; - __afterInit(props: IBaseRendererProps): void; - __executeLifeCycleMethod(method: string, args?: any[]): void; - __bindCustomMethods(props: IBaseRendererProps): void; - __generateCtx(ctx: Record<string, any>): void; - __parseData(data: any, ctx?: any): any; - __initDataSource(props: IBaseRendererProps): void; - __render(): void; - __getRef(ref: any): void; - __getSchemaChildrenVirtualDom( - schema: IPublicTypeNodeSchema | undefined, - Comp: any, - nodeChildrenMap?: any - ): any; - __getComponentProps(schema: IPublicTypeNodeSchema | undefined, scope: any, Comp: any, componentInfo?: any): any; - __createDom(): any; - __createVirtualDom(schema: any, self: any, parentInfo: INodeInfo, idx: string | number): any; - __createLoopVirtualDom(schema: any, self: any, parentInfo: INodeInfo, idx: number | string): any; - __parseProps(props: any, self: any, path: string, info: INodeInfo): any; - __initDebug?(): void; - __debug(...args: any[]): void; - __renderContextProvider(customProps?: object, children?: any): any; - __renderContextConsumer(children: any): any; - __renderContent(children: any): any; - __checkSchema(schema: IPublicTypeNodeSchema | undefined, extraComponents?: string | string[]): any; - __renderComp(Comp: any, ctxProps: object): any; - $(filedId: string, instance?: any): any; - }; +> & { + reloadDataSource(): Promise<any>; + __beforeInit(props: IBaseRendererProps): void; + __init(props: IBaseRendererProps): void; + __afterInit(props: IBaseRendererProps): void; + __executeLifeCycleMethod(method: string, args?: any[]): void; + __bindCustomMethods(props: IBaseRendererProps): void; + __generateCtx(ctx: Record<string, any>): void; + __parseData(data: any, ctx?: any): any; + __initDataSource(props: IBaseRendererProps): void; + __render(): void; + __getRef(ref: any): void; + __getSchemaChildrenVirtualDom( + schema: IPublicTypeNodeSchema | undefined, + Comp: any, + nodeChildrenMap?: any, + ): any; + __getComponentProps( + schema: IPublicTypeNodeSchema | undefined, + scope: any, + Comp: any, + componentInfo?: any, + ): any; + __createDom(): any; + __createVirtualDom(schema: any, self: any, parentInfo: INodeInfo, idx: string | number): any; + __createLoopVirtualDom(schema: any, self: any, parentInfo: INodeInfo, idx: number | string): any; + __parseProps(props: any, self: any, path: string, info: INodeInfo): any; + __initDebug?(): void; + __debug(...args: any[]): void; + __renderContextProvider(customProps?: object, children?: any): any; + __renderContextConsumer(children: any): any; + __renderContent(children: any): any; + __checkSchema( + schema: IPublicTypeNodeSchema | undefined, + extraComponents?: string | string[], + ): any; + __renderComp(Comp: any, ctxProps: object): any; + $(filedId: string, instance?: any): any; +}; export interface IBaseRenderComponent { - new( - props: IBaseRendererProps, - context: any - ): IBaseRendererInstance; + new (props: IBaseRendererProps, context: any): IBaseRendererInstance; } export interface IRenderComponent { @@ -326,7 +340,10 @@ export interface IRenderComponent { defaultProps: IRendererProps; findDOMNode: (...args: any) => any; - new(props: IRendererProps, context: any): IGeneralComponent<IRendererProps, IRendererState> & { + new ( + props: IRendererProps, + context: any, + ): IGeneralComponent<IRendererProps, IRendererState> & { [x: string]: any; __getRef: (ref: any) => void; componentDidMount(): Promise<void> | void; diff --git a/packages/renderer-core/src/utils/common.ts b/packages/renderer-core/src/utils/common.ts index 0462d358a7..67b839f272 100644 --- a/packages/renderer-core/src/utils/common.ts +++ b/packages/renderer-core/src/utils/common.ts @@ -1,15 +1,26 @@ /* eslint-disable no-console */ /* eslint-disable no-new-func */ import logger from './logger'; -import { IPublicTypeRootSchema, IPublicTypeNodeSchema, IPublicTypeJSSlot } from '@alilc/lowcode-types'; -import { isI18nData, isJSExpression } from '@alilc/lowcode-utils'; +import { + IPublicTypeRootSchema, + IPublicTypeNodeSchema, + IPublicTypeJSSlot, +} from '@felce/lowcode-types'; +import { isI18nData, isJSExpression } from '@felce/lowcode-utils'; import { isEmpty } from 'lodash'; import IntlMessageFormat from 'intl-messageformat'; import pkg from '../../package.json'; (window as any).sdkVersion = pkg.version; -export { pick, isEqualWith as deepEqual, cloneDeep as clone, isEmpty, throttle, debounce } from 'lodash'; +export { + pick, + isEqualWith as deepEqual, + cloneDeep as clone, + isEmpty, + throttle, + debounce, +} from 'lodash'; const EXPRESSION_TYPE = { JSEXPRESSION: 'JSExpression', @@ -43,7 +54,7 @@ export function isSchema(schema: any): schema is IPublicTypeNodeSchema { if (isJSExpression(props)) { return true; } - return (typeof schema.props === 'object' && !Array.isArray(props)); + return typeof schema.props === 'object' && !Array.isArray(props); }; return !!(schema.componentName && isValidProps(schema.props)); } @@ -82,7 +93,7 @@ export function getFileCssName(fileName: string) { return; } const name = fileName.replace(/([A-Z])/g, '-$1').toLowerCase(); - return (`lce-${name}`) + return `lce-${name}` .split('-') .filter((p) => !!p) .join('-'); @@ -134,7 +145,12 @@ export function getValue(obj: any, path: string, defaultValue = {}) { * @param {*} locale 国际化标识,例如 zh-CN、en-US * @param {*} messages 国际化语言包 */ -export function getI18n(key: string, values = {}, locale = 'zh-CN', messages: Record<string, any> = {}) { +export function getI18n( + key: string, + values = {}, + locale = 'zh-CN', + messages: Record<string, any> = {}, +) { if (!messages || !messages[locale] || !messages[locale][key]) { return ''; } @@ -150,7 +166,12 @@ export function canAcceptsRef(Comp: any) { const hasSymbol = typeof Symbol === 'function' && Symbol.for; const REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; // eslint-disable-next-line max-len - return Comp?.$$typeof === REACT_FORWARD_REF_TYPE || Comp?.prototype?.isReactComponent || Comp?.prototype?.setState || Comp._forwardRef; + return ( + Comp?.$$typeof === REACT_FORWARD_REF_TYPE || + Comp?.prototype?.isReactComponent || + Comp?.prototype?.setState || + Comp._forwardRef + ); } /** @@ -202,7 +223,10 @@ export function transformStringToFunction(str: string) { */ function parseExpression(options: { - str: any; self: any; thisRequired?: boolean; logScope?: string; + str: any; + self: any; + thisRequired?: boolean; + logScope?: string; }): any; function parseExpression(str: any, self: any, thisRequired?: boolean): any; function parseExpression(a: any, b?: any, c = false) { @@ -244,9 +268,7 @@ function parseExpression(a: any, b?: any, c = false) { } } -export { - parseExpression, -}; +export { parseExpression }; export function parseThisRequiredExpression(str: any, self: any) { return parseExpression(str, self, true); @@ -291,10 +313,13 @@ export function isVariable(obj: any) { * @param self context */ export function parseI18n(i18nInfo: any, self: any) { - return parseExpression({ - type: EXPRESSION_TYPE.JSEXPRESSION, - value: `this.i18n('${i18nInfo.key}')`, - }, self); + return parseExpression( + { + type: EXPRESSION_TYPE.JSEXPRESSION, + value: `this.i18n('${i18nInfo.key}')`, + }, + self, + ); } /** @@ -304,7 +329,12 @@ export function parseI18n(i18nInfo: any, self: any) { * @param context */ export function forEach(targetObj: any, fn: any, context?: any) { - if (!targetObj || Array.isArray(targetObj) || isString(targetObj) || typeof targetObj !== 'object') { + if ( + !targetObj || + Array.isArray(targetObj) || + isString(targetObj) || + typeof targetObj !== 'object' + ) { return; } diff --git a/packages/renderer-core/src/utils/data-helper.ts b/packages/renderer-core/src/utils/data-helper.ts index 41bcb9bfa0..8a9d41ba3d 100644 --- a/packages/renderer-core/src/utils/data-helper.ts +++ b/packages/renderer-core/src/utils/data-helper.ts @@ -1,7 +1,7 @@ /* eslint-disable no-console */ /* eslint-disable max-len */ /* eslint-disable object-curly-newline */ -import { isJSFunction } from '@alilc/lowcode-utils'; +import { isJSFunction } from '@felce/lowcode-utils'; import { transformArrayToMap, transformStringToFunction } from './common'; import { jsonp, request, get, post } from './request'; import logger from './logger'; @@ -40,7 +40,10 @@ export function doRequest(type: DataSourceType, options: any) { } } - logger.log(`Engine default dataSource does not support type:[${type}] dataSource request!`, options); + logger.log( + `Engine default dataSource does not support type:[${type}] dataSource request!`, + options, + ); } // TODO: according to protocol, we should implement errorHandler/shouldFetch/willFetch/requestHandler and isSync controll. @@ -200,9 +203,9 @@ export class DataHelper { Array.isArray(options.params) || Array.isArray(params) ? params || options.params : { - ...options.params, - ...params, - }, + ...options.params, + ...params, + }, headers: { ...options.headers, ...headers, @@ -211,22 +214,22 @@ export class DataHelper { }, }, ]) - .then((res: any) => { - try { - callbackFn && callbackFn(res && res[id]); - } catch (e) { - logger.error('load请求回调函数报错', e); - } - return res && res[id]; - }) - .catch((err) => { - try { - callbackFn && callbackFn(null, err); - } catch (e) { - logger.error('load请求回调函数报错', e); - } - return err; - }); + .then((res: any) => { + try { + callbackFn && callbackFn(res && res[id]); + } catch (e) { + logger.error('load请求回调函数报错', e); + } + return res && res[id]; + }) + .catch((err) => { + try { + callbackFn && callbackFn(null, err); + } catch (e) { + logger.error('load请求回调函数报错', e); + } + return err; + }); } asyncDataHandler(asyncDataList: any[]) { @@ -270,11 +273,13 @@ export class DataHelper { doFetch(type, options); }); }), - ).then(() => { - resolve(res); - }).catch((e) => { - reject(e); - }); + ) + .then(() => { + resolve(res); + }) + .catch((e) => { + reject(e); + }); }); } diff --git a/packages/renderer-core/src/utils/is-use-loop.ts b/packages/renderer-core/src/utils/is-use-loop.ts index b6d67a802a..88396d5001 100644 --- a/packages/renderer-core/src/utils/is-use-loop.ts +++ b/packages/renderer-core/src/utils/is-use-loop.ts @@ -1,9 +1,12 @@ -import { IPublicTypeJSExpression } from '@alilc/lowcode-types'; -import { isJSExpression } from '@alilc/lowcode-utils'; +import { IPublicTypeJSExpression } from '@felce/lowcode-types'; +import { isJSExpression } from '@felce/lowcode-utils'; // 1.渲染模式下,loop 是数组,则按照数组长度渲染组件 // 2.设计模式下,loop 需要长度大于 0,按照循环模式渲染,防止无法设计的情况 -export default function isUseLoop(loop: null | any[] | IPublicTypeJSExpression, isDesignMode: boolean): boolean { +export default function isUseLoop( + loop: null | any[] | IPublicTypeJSExpression, + isDesignMode: boolean, +): boolean { if (isJSExpression(loop)) { return true; } diff --git a/packages/renderer-core/src/utils/logger.ts b/packages/renderer-core/src/utils/logger.ts index 5b7a276eb6..b86d81ae78 100644 --- a/packages/renderer-core/src/utils/logger.ts +++ b/packages/renderer-core/src/utils/logger.ts @@ -1,3 +1,3 @@ -import { Logger } from '@alilc/lowcode-utils'; +import { Logger } from '@felce/lowcode-utils'; -export default new Logger({ level: 'warn', bizName: 'renderer' }); \ No newline at end of file +export default new Logger({ level: 'warn', bizName: 'renderer' }); diff --git a/packages/renderer-core/tests/renderer/__snapshots__/renderer.test.tsx.snap b/packages/renderer-core/tests/renderer/__snapshots__/renderer.test.tsx.snap index 79c5f0f085..8c5fbb2e70 100644 --- a/packages/renderer-core/tests/renderer/__snapshots__/renderer.test.tsx.snap +++ b/packages/renderer-core/tests/renderer/__snapshots__/renderer.test.tsx.snap @@ -69,7 +69,6 @@ exports[`Base Render renderComp 1`] = ` > <li className="next-breadcrumb-item" - dir={null} > <span __id="node_dockcy8n9xeg" @@ -94,7 +93,6 @@ exports[`Base Render renderComp 1`] = ` </li> <li className="next-breadcrumb-item" - dir={null} > <span __id="node_dockcy8n9xei" @@ -119,7 +117,6 @@ exports[`Base Render renderComp 1`] = ` </li> <li className="next-breadcrumb-item" - dir={null} > <span __id="node_dockcy8n9xek" @@ -144,7 +141,6 @@ exports[`Base Render renderComp 1`] = ` </li> <li className="next-breadcrumb-item" - dir={null} > <span __id="node_dockcy8n9xem" @@ -259,10 +255,11 @@ exports[`Base Render renderComp 1`] = ` "hidden": undefined, } } + aria-expanded="false" + aria-label="select" autoComplete="off" disabled={false} height="100%" - maxLength={null} onBlur={[Function]} onChange={[Function]} onCompositionEnd={[Function]} @@ -378,10 +375,11 @@ exports[`Base Render renderComp 1`] = ` "hidden": undefined, } } + aria-expanded="false" + aria-label="select" autoComplete="off" disabled={false} height="100%" - maxLength={null} onBlur={[Function]} onChange={[Function]} onCompositionEnd={[Function]} @@ -485,7 +483,6 @@ exports[`Base Render renderComp 1`] = ` autoComplete="off" disabled={false} height="100%" - maxLength={null} onBlur={[Function]} onChange={[Function]} onCompositionEnd={[Function]} @@ -988,7 +985,6 @@ exports[`Base Render renderComp 1`] = ` autoComplete="off" disabled={false} height="100%" - maxLength={null} onBlur={[Function]} onChange={[Function]} onCompositionEnd={[Function]} @@ -1048,10 +1044,11 @@ exports[`Base Render renderComp 1`] = ` "hidden": undefined, } } + aria-expanded="false" + aria-label="select" autoComplete="off" disabled={false} height="100%" - maxLength={null} name="error" onBlur={[Function]} onChange={[Function]} diff --git a/packages/shell/package.json b/packages/shell/package.json index c2b62e2270..693cfaa2ec 100644 --- a/packages/shell/package.json +++ b/packages/shell/package.json @@ -1,6 +1,6 @@ { - "name": "@alilc/lowcode-shell", - "version": "1.3.2", + "name": "@felce/lowcode-shell", + "version": "1.4.0", "description": "Shell Layer for AliLowCodeEngine", "main": "lib/index.js", "module": "es/index.js", @@ -13,12 +13,13 @@ }, "license": "MIT", "dependencies": { - "@alilc/lowcode-designer": "1.3.2", - "@alilc/lowcode-editor-core": "1.3.2", - "@alilc/lowcode-editor-skeleton": "1.3.2", - "@alilc/lowcode-types": "1.3.2", - "@alilc/lowcode-utils": "1.3.2", - "@alilc/lowcode-workspace": "1.3.2", + "@alifd/next": "^1.26.0", + "@felce/lowcode-designer": "1.4.0", + "@felce/lowcode-editor-core": "1.4.0", + "@felce/lowcode-editor-skeleton": "1.4.0", + "@felce/lowcode-types": "1.4.0", + "@felce/lowcode-utils": "1.4.0", + "@felce/lowcode-workspace": "1.4.0", "classnames": "^2.2.6", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.5", @@ -46,9 +47,9 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/shell" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/packages/shell" }, "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/packages/shell/src/api/canvas.ts b/packages/shell/src/api/canvas.ts index 48acbc487a..1554c7a8f0 100644 --- a/packages/shell/src/api/canvas.ts +++ b/packages/shell/src/api/canvas.ts @@ -9,11 +9,8 @@ import { IPublicModelDragon, IPublicModelActiveTracker, IPublicModelClipboard, -} from '@alilc/lowcode-types'; -import { - ScrollTarget as InnerScrollTarget, - IDesigner, -} from '@alilc/lowcode-designer'; +} from '@felce/lowcode-types'; +import { ScrollTarget as InnerScrollTarget, IDesigner } from '@felce/lowcode-designer'; import { editorSymbol, designerSymbol, nodeSymbol } from '../symbols'; import { Dragon as ShellDragon, @@ -50,7 +47,10 @@ export class Canvas implements IPublicApiCanvas { return this[clipboardInstanceSymbol]; } - constructor(editor: IPublicModelEditor, readonly workspaceMode: boolean = false) { + constructor( + editor: IPublicModelEditor, + readonly workspaceMode: boolean = false, + ) { this[editorSymbol] = editor; this[clipboardInstanceSymbol] = new ShellClipboard(); } @@ -67,10 +67,12 @@ export class Canvas implements IPublicApiCanvas { * 创建插入位置,考虑放到 dragon 中 */ createLocation(locationData: IPublicTypeLocationData): IPublicModelDropLocation { - return new DropLocation(this[designerSymbol].createLocation({ - ...locationData, - target: (locationData.target as any)[nodeSymbol], - })); + return new DropLocation( + this[designerSymbol].createLocation({ + ...locationData, + target: (locationData.target as any)[nodeSymbol], + }), + ); } /** diff --git a/packages/shell/src/api/command.ts b/packages/shell/src/api/command.ts index ebab4a9ff5..d2bc715762 100644 --- a/packages/shell/src/api/command.ts +++ b/packages/shell/src/api/command.ts @@ -1,6 +1,12 @@ -import { IPublicApiCommand, IPublicModelPluginContext, IPublicTypeCommand, IPublicTypeCommandHandlerArgs, IPublicTypeListCommand } from '@alilc/lowcode-types'; +import { + IPublicApiCommand, + IPublicModelPluginContext, + IPublicTypeCommand, + IPublicTypeCommandHandlerArgs, + IPublicTypeListCommand, +} from '@felce/lowcode-types'; import { commandSymbol, pluginContextSymbol } from '../symbols'; -import { ICommand, ICommandOptions } from '@alilc/lowcode-editor-core'; +import { ICommand, ICommandOptions } from '@felce/lowcode-editor-core'; const optionsSymbol = Symbol('options'); const commandScopeSet = new Set<string>(); @@ -10,7 +16,11 @@ export class Command implements IPublicApiCommand { [optionsSymbol]?: ICommandOptions; [pluginContextSymbol]?: IPublicModelPluginContext; - constructor(innerCommand: ICommand, pluginContext?: IPublicModelPluginContext, options?: ICommandOptions) { + constructor( + innerCommand: ICommand, + pluginContext?: IPublicModelPluginContext, + options?: ICommandOptions, + ) { this[commandSymbol] = innerCommand; this[optionsSymbol] = options; this[pluginContextSymbol] = pluginContext; diff --git a/packages/shell/src/api/common.tsx b/packages/shell/src/api/common.tsx index 8ce07153ad..eee286fe5c 100644 --- a/packages/shell/src/api/common.tsx +++ b/packages/shell/src/api/common.tsx @@ -1,4 +1,12 @@ -import { editorSymbol, skeletonSymbol, designerCabinSymbol, designerSymbol, settingFieldSymbol, editorCabinSymbol, skeletonCabinSymbol } from '../symbols'; +import { + editorSymbol, + skeletonSymbol, + designerCabinSymbol, + designerSymbol, + settingFieldSymbol, + editorCabinSymbol, + skeletonCabinSymbol, +} from '../symbols'; import { isFormEvent as innerIsFormEvent, compatibleLegaoSchema as innerCompatibleLegaoSchema, @@ -12,7 +20,7 @@ import { isNode as innerIsNode, isSettingField, isSettingField as innerIsSettingField, -} from '@alilc/lowcode-utils'; +} from '@felce/lowcode-utils'; import { IPublicTypeNodeSchema, IPublicEnumTransitionType, @@ -27,7 +35,7 @@ import { IPublicModelDragon, IPublicModelSettingField, IPublicTypeI18nData, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { SettingField as InnerSettingField, LiveEditing as InnerLiveEditing, @@ -42,7 +50,7 @@ import { Node as InnerNode, LowCodePluginManager as InnerLowCodePluginManager, DesignerView as InnerDesignerView, -} from '@alilc/lowcode-designer'; +} from '@felce/lowcode-designer'; import { Skeleton as InnerSkeleton, createSettingFieldView as innerCreateSettingFieldView, @@ -51,7 +59,7 @@ import { Workbench as InnerWorkbench, SettingsPrimaryPane as InnerSettingsPrimaryPane, registerDefaults as InnerRegisterDefaults, -} from '@alilc/lowcode-editor-skeleton'; +} from '@felce/lowcode-editor-skeleton'; import { Editor, Title as InnerTitle, @@ -70,7 +78,7 @@ import { runInAction as innerRunInAction, engineConfig as innerEngineConfig, globalContext, -} from '@alilc/lowcode-editor-core'; +} from '@felce/lowcode-editor-core'; import { Dragon as ShellDragon } from '../model'; import { ReactNode } from 'react'; @@ -113,7 +121,7 @@ class DesignerCabin implements IPublicApiCommonDesignerCabin { /** * 是否是 SettingField 实例 - * @deprecated use same function from @alilc/lowcode-utils directly + * @deprecated use same function from @felce/lowcode-utilsirectly */ isSettingField(obj: any): boolean { return isSettingField(obj); @@ -121,8 +129,8 @@ class DesignerCabin implements IPublicApiCommonDesignerCabin { /** * 转换类型枚举对象,包含 init / upgrade / render 等类型 - * [参考](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/transform-stage.ts) - * @deprecated use { TransformStage } from '@alilc/lowcode-types' instead + * [参考](https://github.com/fe-lce/lowcode-engine/blob/main/packages/types/src/transform-stage.ts) + * @deprecated use { TransformStage } from '@felce/lowcode-types' instead */ get TransformStage() { return InnerTransitionStage; @@ -211,7 +219,7 @@ class SkeletonCabin implements IPublicApiCommonSkeletonCabin { /** * @deprecated */ - get PopupPipe(): any { + get PopupPipe(): any { return InnerPopupPipe; } } @@ -233,9 +241,9 @@ class Utils implements IPublicApiCommonUtils { } getNodeSchemaById( - schema: IPublicTypeNodeSchema, - nodeId: string, - ): IPublicTypeNodeSchema | undefined { + schema: IPublicTypeNodeSchema, + nodeId: string, + ): IPublicTypeNodeSchema | undefined { return innerGetNodeSchemaById(schema, nodeId); } @@ -248,18 +256,18 @@ class Utils implements IPublicApiCommonUtils { } executeTransaction( - fn: () => void, - type: IPublicEnumTransitionType = IPublicEnumTransitionType.REPAINT, - ): void { + fn: () => void, + type: IPublicEnumTransitionType = IPublicEnumTransitionType.REPAINT, + ): void { transactionManager.executeTransaction(fn, type); } createIntl(instance: string | object): { - intlNode(id: string, params?: object): ReactNode; - intl(id: string, params?: object): string; - getLocale(): string; - setLocale(locale: string): void; - } { + intlNode(id: string, params?: object): ReactNode; + intl(id: string, params?: object): string; + getLocale(): string; + setLocale(locale: string): void; + } { return innerCreateIntl(instance); } @@ -458,11 +466,11 @@ export class Common implements IPublicApiCommon { /** * 历史原因导致此处设计不合理,慎用。 * this load of crap will be removed in some future versions, don`t use it. - * @deprecated use { TransformStage } from '@alilc/lowcode-types' instead + * @deprecated use { TransformStage } from '@felce/lowcode-types' instead */ get objects(): any { return { TransformStage: InnerTransitionStage, }; } -} \ No newline at end of file +} diff --git a/packages/shell/src/api/commonUI.tsx b/packages/shell/src/api/commonUI.tsx index 69dd104b2a..d782fde944 100644 --- a/packages/shell/src/api/commonUI.tsx +++ b/packages/shell/src/api/commonUI.tsx @@ -1,11 +1,38 @@ -import { IPublicApiCommonUI, IPublicModelPluginContext, IPublicTypeContextMenuAction } from '@alilc/lowcode-types'; import { - HelpTip, - IEditor, - Tip as InnerTip, - Title as InnerTitle, - } from '@alilc/lowcode-editor-core'; -import { Balloon, Breadcrumb, Button, Card, Checkbox, DatePicker, Dialog, Dropdown, Form, Icon, Input, Loading, Message, Overlay, Pagination, Radio, Search, Select, SplitButton, Step, Switch, Tab, Table, Tree, TreeSelect, Upload, Divider } from '@alifd/next'; + IPublicApiCommonUI, + IPublicModelPluginContext, + IPublicTypeContextMenuAction, +} from '@felce/lowcode-types'; +import { HelpTip, IEditor, Tip as InnerTip, Title as InnerTitle } from '@felce/lowcode-editor-core'; +import { + Balloon, + Breadcrumb, + Button, + Card, + Checkbox, + DatePicker, + Dialog, + Dropdown, + Form, + Icon, + Input, + Loading, + Message, + Overlay, + Pagination, + Radio, + Search, + Select, + SplitButton, + Step, + Switch, + Tab, + Table, + Tree, + TreeSelect, + Upload, + Divider, +} from '@alifd/next'; import { ContextMenu } from '../components/context-menu'; import { editorSymbol } from '../symbols'; import { ReactElement } from 'react'; @@ -13,33 +40,33 @@ import { ReactElement } from 'react'; export class CommonUI implements IPublicApiCommonUI { [editorSymbol]: IEditor; - Balloon = Balloon; - Breadcrumb = Breadcrumb; - Button = Button; - Card = Card; - Checkbox = Checkbox; - DatePicker = DatePicker; - Dialog = Dialog; - Dropdown = Dropdown; - Form = Form; - Icon = Icon; - Input = Input; - Loading = Loading as any; - Message = Message; - Overlay = Overlay; - Pagination = Pagination; - Radio = Radio; - Search = Search; - Select = Select; - SplitButton = SplitButton; - Step = Step; - Switch = Switch; - Tab = Tab; - Table = Table; - Tree = Tree; - TreeSelect = TreeSelect; - Upload = Upload; - Divider = Divider; + Balloon: typeof Balloon = Balloon; + Breadcrumb: typeof Breadcrumb = Breadcrumb; + Button: typeof Button = Button; + Card: typeof Card = Card; + Checkbox: typeof Checkbox = Checkbox; + DatePicker: typeof DatePicker = DatePicker; + Dialog: typeof Dialog = Dialog; + Dropdown: typeof Dropdown = Dropdown; + Form: typeof Form = Form; + Icon: typeof Icon = Icon; + Input: typeof Input = Input; + Loading: typeof Loading = Loading; + Message: typeof Message = Message; + Overlay: typeof Overlay = Overlay; + Pagination: typeof Pagination = Pagination; + Radio: typeof Radio = Radio; + Search: typeof Search = Search; + Select: typeof Select = Select; + SplitButton: typeof SplitButton = SplitButton; + Step: typeof Step = Step; + Switch: typeof Switch = Switch; + Tab: typeof Tab = Tab; + Table: typeof Table = Table; + Tree: typeof Tree = Tree; + TreeSelect: typeof TreeSelect = TreeSelect; + Upload: typeof Upload = Upload; + Divider: typeof Divider = Divider; ContextMenu: ((props: { menus: IPublicTypeContextMenuAction[]; @@ -52,12 +79,16 @@ export class CommonUI implements IPublicApiCommonUI { this[editorSymbol] = editor; const innerContextMenu = (props: any) => { - const pluginContext: IPublicModelPluginContext = editor.get('pluginContext') as IPublicModelPluginContext; + const pluginContext: IPublicModelPluginContext = editor.get( + 'pluginContext', + ) as IPublicModelPluginContext; return <ContextMenu {...props} pluginContext={pluginContext} />; }; innerContextMenu.create = (menus: IPublicTypeContextMenuAction[], event: MouseEvent) => { - const pluginContext: IPublicModelPluginContext = editor.get('pluginContext') as IPublicModelPluginContext; + const pluginContext: IPublicModelPluginContext = editor.get( + 'pluginContext', + ) as IPublicModelPluginContext; return ContextMenu.create(pluginContext, menus, event); }; diff --git a/packages/shell/src/api/config.ts b/packages/shell/src/api/config.ts index d841208780..f70b7ba5a3 100644 --- a/packages/shell/src/api/config.ts +++ b/packages/shell/src/api/config.ts @@ -1,6 +1,10 @@ -import { IPublicModelEngineConfig, IPublicModelPreference, IPublicTypeDisposable } from '@alilc/lowcode-types'; +import { + IPublicModelEngineConfig, + IPublicModelPreference, + IPublicTypeDisposable, +} from '@felce/lowcode-types'; import { configSymbol } from '../symbols'; -import { IEngineConfig } from '@alilc/lowcode-editor-core'; +import { IEngineConfig } from '@felce/lowcode-editor-core'; export class Config implements IPublicModelEngineConfig { private readonly [configSymbol]: IEngineConfig; diff --git a/packages/shell/src/api/event.ts b/packages/shell/src/api/event.ts index f2adca98c1..dea03351ca 100644 --- a/packages/shell/src/api/event.ts +++ b/packages/shell/src/api/event.ts @@ -1,6 +1,6 @@ -import { IEditor, IEventBus } from '@alilc/lowcode-editor-core'; -import { getLogger, isPluginEventName } from '@alilc/lowcode-utils'; -import { IPublicApiEvent, IPublicTypeDisposable } from '@alilc/lowcode-types'; +import { IEditor, IEventBus } from '@felce/lowcode-editor-core'; +import { getLogger, isPluginEventName } from '@felce/lowcode-utils'; +import { IPublicApiEvent, IPublicTypeDisposable } from '@felce/lowcode-types'; const logger = getLogger({ level: 'warn', bizName: 'shell-event' }); @@ -14,7 +14,11 @@ export class Event implements IPublicApiEvent { private readonly [eventBusSymbol]: IEventBus; private readonly options: EventOptions; - constructor(eventBus: IEventBus, options: EventOptions, public workspaceMode = false) { + constructor( + eventBus: IEventBus, + options: EventOptions, + public workspaceMode = false, + ) { this[eventBusSymbol] = eventBus; this.options = options; if (!this.options.prefix) { @@ -31,7 +35,9 @@ export class Event implements IPublicApiEvent { if (isPluginEventName(event)) { return this[eventBusSymbol].on(event, listener); } else { - logger.warn(`fail to monitor on event ${event}, event should have a prefix like 'somePrefix:eventName'`); + logger.warn( + `fail to monitor on event ${event}, event should have a prefix like 'somePrefix:eventName'`, + ); return () => {}; } } @@ -45,7 +51,9 @@ export class Event implements IPublicApiEvent { if (isPluginEventName(event)) { return this[eventBusSymbol].prependListener(event, listener); } else { - logger.warn(`fail to prependListener event ${event}, event should have a prefix like 'somePrefix:eventName'`); + logger.warn( + `fail to prependListener event ${event}, event should have a prefix like 'somePrefix:eventName'`, + ); return () => {}; } } diff --git a/packages/shell/src/api/hotkey.ts b/packages/shell/src/api/hotkey.ts index 4e65844ceb..e3e5917e85 100644 --- a/packages/shell/src/api/hotkey.ts +++ b/packages/shell/src/api/hotkey.ts @@ -1,6 +1,11 @@ -import { globalContext, Hotkey as InnerHotkey } from '@alilc/lowcode-editor-core'; +import { globalContext, Hotkey as InnerHotkey } from '@felce/lowcode-editor-core'; import { hotkeySymbol } from '../symbols'; -import { IPublicTypeDisposable, IPublicTypeHotkeyCallback, IPublicTypeHotkeyCallbacks, IPublicApiHotkey } from '@alilc/lowcode-types'; +import { + IPublicTypeDisposable, + IPublicTypeHotkeyCallback, + IPublicTypeHotkeyCallbacks, + IPublicApiHotkey, +} from '@felce/lowcode-types'; const innerHotkeySymbol = Symbol('innerHotkey'); @@ -18,7 +23,10 @@ export class Hotkey implements IPublicApiHotkey { return this[innerHotkeySymbol]; } - constructor(hotkey: InnerHotkey, readonly workspaceMode: boolean = false) { + constructor( + hotkey: InnerHotkey, + readonly workspaceMode: boolean = false, + ) { this[innerHotkeySymbol] = hotkey; } @@ -41,13 +49,13 @@ export class Hotkey implements IPublicApiHotkey { * @returns */ bind( - combos: string[] | string, - callback: IPublicTypeHotkeyCallback, - action?: string, - ): IPublicTypeDisposable { + combos: string[] | string, + callback: IPublicTypeHotkeyCallback, + action?: string, + ): IPublicTypeDisposable { this[hotkeySymbol].bind(combos, callback, action); return () => { this[hotkeySymbol].unbind(combos, callback, action); }; } -} \ No newline at end of file +} diff --git a/packages/shell/src/api/logger.ts b/packages/shell/src/api/logger.ts index 54fee7a660..d1dd793c78 100644 --- a/packages/shell/src/api/logger.ts +++ b/packages/shell/src/api/logger.ts @@ -1,6 +1,5 @@ - -import { getLogger } from '@alilc/lowcode-utils'; -import { IPublicApiLogger, ILoggerOptions } from '@alilc/lowcode-types'; +import { getLogger } from '@felce/lowcode-utils'; +import { IPublicApiLogger, ILoggerOptions } from '@felce/lowcode-types'; const innerLoggerSymbol = Symbol('logger'); @@ -45,4 +44,4 @@ export class Logger implements IPublicApiLogger { log(...args: any | any[]): void { this[innerLoggerSymbol].log(...args); } -} \ No newline at end of file +} diff --git a/packages/shell/src/api/material.ts b/packages/shell/src/api/material.ts index 284b88fbbf..e8d7a08aee 100644 --- a/packages/shell/src/api/material.ts +++ b/packages/shell/src/api/material.ts @@ -1,9 +1,6 @@ -import { globalContext } from '@alilc/lowcode-editor-core'; -import { - IDesigner, - isComponentMeta, -} from '@alilc/lowcode-designer'; -import { IPublicTypeAssetsJson, getLogger } from '@alilc/lowcode-utils'; +import { globalContext } from '@felce/lowcode-editor-core'; +import { IDesigner, isComponentMeta } from '@felce/lowcode-designer'; +import { IPublicTypeAssetsJson, getLogger } from '@felce/lowcode-utils'; import { IPublicTypeComponentAction, IPublicTypeComponentMetadata, @@ -15,8 +12,8 @@ import { IPublicTypeDisposable, IPublicTypeContextMenuAction, IPublicTypeContextMenuItem, -} from '@alilc/lowcode-types'; -import { Workspace as InnerWorkspace } from '@alilc/lowcode-workspace'; +} from '@felce/lowcode-types'; +import { Workspace as InnerWorkspace } from '@felce/lowcode-workspace'; import { editorSymbol, designerSymbol } from '../symbols'; import { ComponentMeta as ShellComponentMeta } from '../model'; import { ComponentType } from 'react'; @@ -47,7 +44,10 @@ export class Material implements IPublicApiMaterial { return this[editorSymbol].get('designer')!; } - constructor(editor: IPublicModelEditor, readonly workspaceMode: boolean = false) { + constructor( + editor: IPublicModelEditor, + readonly workspaceMode: boolean = false, + ) { this[innerEditorSymbol] = editor; } @@ -176,9 +176,9 @@ export class Material implements IPublicApiMaterial { * @param handle */ modifyBuiltinComponentAction( - actionName: string, - handle: (action: IPublicTypeComponentAction) => void, - ) { + actionName: string, + handle: (action: IPublicTypeComponentAction) => void, + ) { this[designerSymbol].componentActions.modifyBuiltinComponentAction(actionName, handle); } @@ -195,7 +195,7 @@ export class Material implements IPublicApiMaterial { ]; return () => { - dispose.forEach(d => d && d()); + dispose.forEach((d) => d && d()); }; } @@ -207,7 +207,9 @@ export class Material implements IPublicApiMaterial { this[designerSymbol].contextMenuActions.removeMenuAction(name); } - adjustContextMenuLayout(fn: (actions: IPublicTypeContextMenuItem[]) => IPublicTypeContextMenuItem[]) { + adjustContextMenuLayout( + fn: (actions: IPublicTypeContextMenuItem[]) => IPublicTypeContextMenuItem[], + ) { this[designerSymbol].contextMenuActions.adjustMenuLayout(fn); } } diff --git a/packages/shell/src/api/plugins.ts b/packages/shell/src/api/plugins.ts index b6f5e63717..0bb751ee7e 100644 --- a/packages/shell/src/api/plugins.ts +++ b/packages/shell/src/api/plugins.ts @@ -1,14 +1,12 @@ -import { - ILowCodePluginManager, -} from '@alilc/lowcode-designer'; -import { globalContext } from '@alilc/lowcode-editor-core'; +import { ILowCodePluginManager } from '@felce/lowcode-designer'; +import { globalContext } from '@felce/lowcode-editor-core'; import { IPublicApiPlugins, IPublicModelPluginInstance, IPublicTypePlugin, IPublicTypePluginRegisterOptions, IPublicTypePreferenceValueType, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { PluginInstance as ShellPluginInstance } from '../model'; import { pluginsSymbol } from '../symbols'; @@ -27,7 +25,10 @@ export class Plugins implements IPublicApiPlugins { return this[innerPluginsSymbol]; } - constructor(plugins: ILowCodePluginManager, public workspaceMode: boolean = false) { + constructor( + plugins: ILowCodePluginManager, + public workspaceMode: boolean = false, + ) { this[innerPluginsSymbol] = plugins; } @@ -44,8 +45,8 @@ export class Plugins implements IPublicApiPlugins { } getPluginPreference( - pluginName: string, - ): Record<string, IPublicTypePreferenceValueType> | null | undefined { + pluginName: string, + ): Record<string, IPublicTypePreferenceValueType> | null | undefined { return this[pluginsSymbol].getPluginPreference(pluginName); } diff --git a/packages/shell/src/api/project.ts b/packages/shell/src/api/project.ts index f005d0af0c..56453919c6 100644 --- a/packages/shell/src/api/project.ts +++ b/packages/shell/src/api/project.ts @@ -1,8 +1,5 @@ -import { - BuiltinSimulatorHost, - IProject as InnerProject, -} from '@alilc/lowcode-designer'; -import { globalContext } from '@alilc/lowcode-editor-core'; +import { BuiltinSimulatorHost, IProject as InnerProject } from '@felce/lowcode-designer'; +import { globalContext } from '@felce/lowcode-editor-core'; import { IPublicTypeRootSchema, IPublicTypeProjectSchema, @@ -14,11 +11,11 @@ import { IPublicEnumTransformStage, IPublicTypeDisposable, IPublicTypeAppConfig, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { DocumentModel as ShellDocumentModel } from '../model'; import { SimulatorHost } from './simulator-host'; import { editorSymbol, projectSymbol, simulatorHostSymbol, documentSymbol } from '../symbols'; -import { getLogger } from '@alilc/lowcode-utils'; +import { getLogger } from '@felce/lowcode-utils'; const logger = getLogger({ level: 'warn', bizName: 'shell-project' }); @@ -46,7 +43,10 @@ export class Project implements IPublicApiProject { return this[projectSymbol]?.designer.editor; } - constructor(project: InnerProject, public workspaceMode: boolean = false) { + constructor( + project: InnerProject, + public workspaceMode: boolean = false, + ) { this[innerProjectSymbol] = project; } @@ -74,7 +74,9 @@ export class Project implements IPublicApiProject { * 获取模拟器的 host */ get simulatorHost(): IPublicApiSimulatorHost | null { - return SimulatorHost.create(this[projectSymbol].simulator as any || this[simulatorHostSymbol]); + return SimulatorHost.create( + (this[projectSymbol].simulator as any) || this[simulatorHostSymbol], + ); } /** @@ -164,9 +166,9 @@ export class Project implements IPublicApiProject { * @param stage */ addPropsTransducer( - transducer: IPublicTypePropsTransducer, - stage: IPublicEnumTransformStage, - ): void { + transducer: IPublicTypePropsTransducer, + stage: IPublicEnumTransformStage, + ): void { this[projectSymbol].designer.addPropsReducer(transducer, stage); } @@ -175,11 +177,10 @@ export class Project implements IPublicApiProject { * @param fn * @returns */ - onRemoveDocument(fn: (data: { id: string}) => void): IPublicTypeDisposable { - return this[editorSymbol].eventBus.on( - 'designer.document.remove', - (data: { id: string }) => fn(data), - ); + onRemoveDocument(fn: (data: { id: string }) => void): IPublicTypeDisposable { + return this[editorSymbol].eventBus.on('designer.document.remove', (data: { id: string }) => + fn(data), + ); } /** @@ -217,7 +218,7 @@ export class Project implements IPublicApiProject { /** * 设置多语言语料 - * 数据格式参考 https://github.com/alibaba/lowcode-engine/blob/main/specs/lowcode-spec.md#2434%E5%9B%BD%E9%99%85%E5%8C%96%E5%A4%9A%E8%AF%AD%E8%A8%80%E7%B1%BB%E5%9E%8Baa + * 数据格式参考 https://github.com/fe-lce/lowcode-engine/blob/main/specs/lowcode-spec.md#2434%E5%9B%BD%E9%99%85%E5%8C%96%E5%A4%9A%E8%AF%AD%E8%A8%80%E7%B1%BB%E5%9E%8Baa * @param value object * @returns */ diff --git a/packages/shell/src/api/setters.ts b/packages/shell/src/api/setters.ts index b7f2d40ecf..ec762ca1ef 100644 --- a/packages/shell/src/api/setters.ts +++ b/packages/shell/src/api/setters.ts @@ -1,7 +1,11 @@ -import { IPublicTypeCustomView, IPublicApiSetters, IPublicTypeRegisteredSetter } from '@alilc/lowcode-types'; -import { ISetters, globalContext, untracked } from '@alilc/lowcode-editor-core'; +import { + IPublicTypeCustomView, + IPublicApiSetters, + IPublicTypeRegisteredSetter, +} from '@felce/lowcode-types'; +import { ISetters, globalContext, untracked } from '@felce/lowcode-editor-core'; import { ReactNode } from 'react'; -import { getLogger } from '@alilc/lowcode-utils'; +import { getLogger } from '@felce/lowcode-utils'; const innerSettersSymbol = Symbol('setters'); const settersSymbol = Symbol('setters'); @@ -30,7 +34,10 @@ export class Setters implements IPublicApiSetters { return this[innerSettersSymbol]; } - constructor(innerSetters: ISetters, readonly workspaceMode = false) { + constructor( + innerSetters: ISetters, + readonly workspaceMode = false, + ) { this[innerSettersSymbol] = innerSetters; } @@ -47,9 +54,12 @@ export class Setters implements IPublicApiSetters { * 获取已注册的所有 settersMap * @returns */ - getSettersMap = (): Map<string, IPublicTypeRegisteredSetter & { - type: string; - }> => { + getSettersMap = (): Map< + string, + IPublicTypeRegisteredSetter & { + type: string; + } + > => { return this[settersSymbol].getSettersMap(); }; diff --git a/packages/shell/src/api/simulator-host.ts b/packages/shell/src/api/simulator-host.ts index 663ba0c668..b176f4a497 100644 --- a/packages/shell/src/api/simulator-host.ts +++ b/packages/shell/src/api/simulator-host.ts @@ -1,8 +1,10 @@ -import { - BuiltinSimulatorHost, -} from '@alilc/lowcode-designer'; +import { BuiltinSimulatorHost } from '@felce/lowcode-designer'; import { simulatorHostSymbol, nodeSymbol } from '../symbols'; -import { IPublicApiSimulatorHost, IPublicModelNode, IPublicModelSimulatorRender } from '@alilc/lowcode-types'; +import { + IPublicApiSimulatorHost, + IPublicModelNode, + IPublicModelSimulatorRender, +} from '@felce/lowcode-types'; import { SimulatorRender } from '../model/simulator-render'; export class SimulatorHost implements IPublicApiSimulatorHost { diff --git a/packages/shell/src/api/skeleton.ts b/packages/shell/src/api/skeleton.ts index c61edf95d0..aeb7014a51 100644 --- a/packages/shell/src/api/skeleton.ts +++ b/packages/shell/src/api/skeleton.ts @@ -1,11 +1,15 @@ -import { globalContext } from '@alilc/lowcode-editor-core'; -import { - ISkeleton, - SkeletonEvents, -} from '@alilc/lowcode-editor-skeleton'; +import { globalContext } from '@felce/lowcode-editor-core'; +import { ISkeleton, SkeletonEvents } from '@felce/lowcode-editor-skeleton'; import { skeletonSymbol } from '../symbols'; -import { IPublicApiSkeleton, IPublicModelSkeletonItem, IPublicTypeConfigTransducer, IPublicTypeDisposable, IPublicTypeSkeletonConfig, IPublicTypeWidgetConfigArea } from '@alilc/lowcode-types'; -import { getLogger } from '@alilc/lowcode-utils'; +import { + IPublicApiSkeleton, + IPublicModelSkeletonItem, + IPublicTypeConfigTransducer, + IPublicTypeDisposable, + IPublicTypeSkeletonConfig, + IPublicTypeWidgetConfigArea, +} from '@felce/lowcode-types'; +import { getLogger } from '@felce/lowcode-utils'; import { SkeletonItem } from '../model/skeleton-item'; const innerSkeletonSymbol = Symbol('skeleton'); @@ -33,10 +37,10 @@ export class Skeleton implements IPublicApiSkeleton { } constructor( - skeleton: ISkeleton, - pluginName: string, - readonly workspaceMode: boolean = false, - ) { + skeleton: ISkeleton, + pluginName: string, + readonly workspaceMode: boolean = false, + ) { this[innerSkeletonSymbol] = skeleton; this.pluginName = pluginName; } @@ -47,7 +51,10 @@ export class Skeleton implements IPublicApiSkeleton { * @param extraConfig * @returns */ - add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>): IPublicModelSkeletonItem | undefined { + add( + config: IPublicTypeSkeletonConfig, + extraConfig?: Record<string, any>, + ): IPublicModelSkeletonItem | undefined { const configWithName = { ...config, pluginName: this.pluginName, @@ -73,7 +80,9 @@ export class Skeleton implements IPublicApiSkeleton { } getAreaItems(areaName: IPublicTypeWidgetConfigArea): IPublicModelSkeletonItem[] { - return this[skeletonSymbol][normalizeArea(areaName)].container.items?.map(d => new SkeletonItem(d)); + return this[skeletonSymbol][normalizeArea(areaName)].container.items?.map( + (d) => new SkeletonItem(d), + ); } getPanel(name: string) { @@ -154,7 +163,9 @@ export class Skeleton implements IPublicApiSkeleton { * @param listener * @returns */ - onShowPanel(listener: (paneName: string, panel: IPublicModelSkeletonItem) => void): IPublicTypeDisposable { + onShowPanel( + listener: (paneName: string, panel: IPublicModelSkeletonItem) => void, + ): IPublicTypeDisposable { const { editor } = this[skeletonSymbol]; editor.eventBus.on(SkeletonEvents.PANEL_SHOW, (name: any, panel: any) => { listener(name, new SkeletonItem(panel)); @@ -222,7 +233,19 @@ export class Skeleton implements IPublicApiSkeleton { } } -function normalizeArea(area: IPublicTypeWidgetConfigArea | undefined): 'leftArea' | 'rightArea' | 'topArea' | 'toolbar' | 'mainArea' | 'bottomArea' | 'leftFixedArea' | 'leftFloatArea' | 'stages' | 'subTopArea' { +function normalizeArea( + area: IPublicTypeWidgetConfigArea | undefined, +): + | 'leftArea' + | 'rightArea' + | 'topArea' + | 'toolbar' + | 'mainArea' + | 'bottomArea' + | 'leftFixedArea' + | 'leftFloatArea' + | 'stages' + | 'subTopArea' { switch (area) { case 'leftArea': case 'left': diff --git a/packages/shell/src/api/workspace.ts b/packages/shell/src/api/workspace.ts index f5bc79009f..16b758586f 100644 --- a/packages/shell/src/api/workspace.ts +++ b/packages/shell/src/api/workspace.ts @@ -1,5 +1,10 @@ -import { IPublicApiWorkspace, IPublicResourceList, IPublicTypeDisposable, IPublicTypeResourceType } from '@alilc/lowcode-types'; -import { IWorkspace } from '@alilc/lowcode-workspace'; +import { + IPublicApiWorkspace, + IPublicResourceList, + IPublicTypeDisposable, + IPublicTypeResourceType, +} from '@felce/lowcode-types'; +import { IWorkspace } from '@felce/lowcode-workspace'; import { resourceSymbol, workspaceSymbol } from '../symbols'; import { Resource as ShellResource, Window as ShellWindow } from '../model'; import { Plugins } from './plugins'; @@ -38,21 +43,16 @@ export class Workspace implements IPublicApiWorkspace { get resourceTypeList() { return Array.from(this[workspaceSymbol].resourceTypeMap.values()).map((d) => { const { name: resourceName, type: resourceType } = d; - const { - description, - editorViews, - } = d.resourceTypeModel({} as any, {}); + const { description, editorViews } = d.resourceTypeModel({} as any, {}); return { resourceName, resourceType, description, - editorViews: editorViews.map(d => ( - { - viewName: d.viewName, - viewType: d.viewType || 'editor', - } - )), + editorViews: editorViews.map((d) => ({ + viewName: d.viewName, + viewType: d.viewType || 'editor', + })), }; }); } @@ -67,9 +67,18 @@ export class Workspace implements IPublicApiWorkspace { async openEditorWindow(): Promise<void> { if (typeof arguments[0] === 'string') { - await this[workspaceSymbol].openEditorWindow(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]); + await this[workspaceSymbol].openEditorWindow( + arguments[0], + arguments[1], + arguments[2], + arguments[3], + arguments[4], + ); } else { - await this[workspaceSymbol].openEditorWindowByResource(arguments[0]?.[resourceSymbol], arguments[1]); + await this[workspaceSymbol].openEditorWindowByResource( + arguments[0]?.[resourceSymbol], + arguments[1], + ); } } diff --git a/packages/shell/src/components/context-menu.tsx b/packages/shell/src/components/context-menu.tsx index 8c7ab446ba..fadb3a8c61 100644 --- a/packages/shell/src/components/context-menu.tsx +++ b/packages/shell/src/components/context-menu.tsx @@ -1,66 +1,79 @@ -import { createContextMenu, parseContextMenuAsReactNode, parseContextMenuProperties } from '@alilc/lowcode-utils'; -import { engineConfig } from '@alilc/lowcode-editor-core'; -import { IPublicModelPluginContext, IPublicTypeContextMenuAction } from '@alilc/lowcode-types'; +import { + createContextMenu, + parseContextMenuAsReactNode, + parseContextMenuProperties, +} from '@felce/lowcode-utils'; +import { engineConfig } from '@felce/lowcode-editor-core'; +import { IPublicModelPluginContext, IPublicTypeContextMenuAction } from '@felce/lowcode-types'; import React, { useCallback } from 'react'; -export function ContextMenu({ children, menus, pluginContext }: { +export function ContextMenu({ + children, + menus, + pluginContext, +}: { menus: IPublicTypeContextMenuAction[]; children: React.ReactElement[] | React.ReactElement; pluginContext: IPublicModelPluginContext; }): React.ReactElement<any, string | React.JSXElementConstructor<any>> { - const handleContextMenu = useCallback((event: React.MouseEvent) => { - event.preventDefault(); - event.stopPropagation(); + const handleContextMenu = useCallback( + (event: React.MouseEvent) => { + event.preventDefault(); + event.stopPropagation(); - let destroyFn: Function | undefined; - const destroy = () => { - destroyFn?.(); - }; - const children: React.ReactNode[] = parseContextMenuAsReactNode(parseContextMenuProperties(menus, { - destroy, - pluginContext, - }), { pluginContext }); + let destroyFn: Function | undefined; + const destroy = () => { + destroyFn?.(); + }; + const children: React.ReactNode[] = parseContextMenuAsReactNode( + parseContextMenuProperties(menus, { + destroy, + pluginContext, + }), + { pluginContext }, + ); - if (!children?.length) { - return; - } + if (!children?.length) { + return; + } - destroyFn = createContextMenu(children, { event }); - }, [menus]); + destroyFn = createContextMenu(children, { event }); + }, + [menus], + ); if (!engineConfig.get('enableContextMenu')) { - return ( - <>{ children }</> - ); + return <>{children}</>; } if (!menus) { - return ( - <>{ children }</> - ); + return <>{children}</>; } // 克隆 children 并添加 onContextMenu 事件处理器 const childrenWithContextMenu = React.Children.map(children, (child) => - React.cloneElement( - child, - { onContextMenu: handleContextMenu }, - )); - - return ( - <>{childrenWithContextMenu}</> + React.cloneElement(child, { onContextMenu: handleContextMenu }), ); + + return <>{childrenWithContextMenu}</>; } -ContextMenu.create = (pluginContext: IPublicModelPluginContext, menus: IPublicTypeContextMenuAction[], event: MouseEvent) => { +ContextMenu.create = ( + pluginContext: IPublicModelPluginContext, + menus: IPublicTypeContextMenuAction[], + event: MouseEvent, +) => { event.preventDefault(); event.stopPropagation(); - const children: React.ReactNode[] = parseContextMenuAsReactNode(parseContextMenuProperties(menus, { - pluginContext, - }), { - pluginContext, - }); + const children: React.ReactNode[] = parseContextMenuAsReactNode( + parseContextMenuProperties(menus, { + pluginContext, + }), + { + pluginContext, + }, + ); if (!children?.length) { return; @@ -69,4 +82,4 @@ ContextMenu.create = (pluginContext: IPublicModelPluginContext, menus: IPublicTy return createContextMenu(children, { event, }); -}; \ No newline at end of file +}; diff --git a/packages/shell/src/model/active-tracker.ts b/packages/shell/src/model/active-tracker.ts index 32d4c04eb9..77d309ea53 100644 --- a/packages/shell/src/model/active-tracker.ts +++ b/packages/shell/src/model/active-tracker.ts @@ -1,5 +1,9 @@ -import { IPublicModelActiveTracker, IPublicModelNode, IPublicTypeActiveTarget } from '@alilc/lowcode-types'; -import { IActiveTracker as InnerActiveTracker, ActiveTarget } from '@alilc/lowcode-designer'; +import { + IPublicModelActiveTracker, + IPublicModelNode, + IPublicTypeActiveTarget, +} from '@felce/lowcode-types'; +import { IActiveTracker as InnerActiveTracker, ActiveTarget } from '@felce/lowcode-designer'; import { Node as ShellNode } from './node'; import { nodeSymbol } from '../symbols'; @@ -47,4 +51,4 @@ export class ActiveTracker implements IPublicModelActiveTracker { track(node: IPublicModelNode) { this[activeTrackerSymbol].track((node as any)[nodeSymbol]); } -} \ No newline at end of file +} diff --git a/packages/shell/src/model/clipboard.ts b/packages/shell/src/model/clipboard.ts index 9c4b309450..1b840a13e2 100644 --- a/packages/shell/src/model/clipboard.ts +++ b/packages/shell/src/model/clipboard.ts @@ -1,6 +1,6 @@ -import { IPublicModelClipboard } from '@alilc/lowcode-types'; +import { IPublicModelClipboard } from '@felce/lowcode-types'; import { clipboardSymbol } from '../symbols'; -import { IClipboard, clipboard } from '@alilc/lowcode-designer'; +import { IClipboard, clipboard } from '@felce/lowcode-designer'; export class Clipboard implements IPublicModelClipboard { private readonly [clipboardSymbol]: IClipboard; @@ -14,9 +14,9 @@ export class Clipboard implements IPublicModelClipboard { } waitPasteData( - keyboardEvent: KeyboardEvent, - cb: (data: any, clipboardEvent: ClipboardEvent) => void, - ): void { + keyboardEvent: KeyboardEvent, + cb: (data: any, clipboardEvent: ClipboardEvent) => void, + ): void { this[clipboardSymbol].waitPasteData(keyboardEvent, cb); } -} \ No newline at end of file +} diff --git a/packages/shell/src/model/component-meta.ts b/packages/shell/src/model/component-meta.ts index 448f0584ee..d7650e376e 100644 --- a/packages/shell/src/model/component-meta.ts +++ b/packages/shell/src/model/component-meta.ts @@ -1,8 +1,16 @@ +import { IComponentMeta as InnerComponentMeta, INode } from '@felce/lowcode-designer'; import { - IComponentMeta as InnerComponentMeta, - INode, -} from '@alilc/lowcode-designer'; -import { IPublicTypeNodeData, IPublicTypeNodeSchema, IPublicModelComponentMeta, IPublicTypeI18nData, IPublicTypeIconType, IPublicTypeNpmInfo, IPublicTypeTransformedComponentMetadata, IPublicModelNode, IPublicTypeAdvanced, IPublicTypeFieldConfig } from '@alilc/lowcode-types'; + IPublicTypeNodeData, + IPublicTypeNodeSchema, + IPublicModelComponentMeta, + IPublicTypeI18nData, + IPublicTypeIconType, + IPublicTypeNpmInfo, + IPublicTypeTransformedComponentMetadata, + IPublicModelNode, + IPublicTypeAdvanced, + IPublicTypeFieldConfig, +} from '@felce/lowcode-types'; import { componentMetaSymbol, nodeSymbol } from '../symbols'; import { ReactElement } from 'react'; @@ -130,14 +138,14 @@ export class ComponentMeta implements IPublicModelComponentMeta { * @returns */ checkNestingDown( - my: IPublicModelNode | IPublicTypeNodeData, - target: IPublicTypeNodeSchema | IPublicModelNode | IPublicTypeNodeSchema[], - ) { + my: IPublicModelNode | IPublicTypeNodeData, + target: IPublicTypeNodeSchema | IPublicModelNode | IPublicTypeNodeSchema[], + ) { const curNode = (my as any)?.isNode ? (my as any)[nodeSymbol] : my; return this[componentMetaSymbol].checkNestingDown( - curNode as any, - (target as any)[nodeSymbol] || target, - ); + curNode as any, + (target as any)[nodeSymbol] || target, + ); } refreshMetadata(): void { diff --git a/packages/shell/src/model/condition-group.ts b/packages/shell/src/model/condition-group.ts index e2dd316edc..a3e146504d 100644 --- a/packages/shell/src/model/condition-group.ts +++ b/packages/shell/src/model/condition-group.ts @@ -1,5 +1,5 @@ -import type { IExclusiveGroup } from '@alilc/lowcode-designer'; -import { IPublicModelExclusiveGroup, IPublicModelNode } from '@alilc/lowcode-types'; +import type { IExclusiveGroup } from '@felce/lowcode-designer'; +import { IPublicModelExclusiveGroup, IPublicModelNode } from '@felce/lowcode-types'; import { conditionGroupSymbol, nodeSymbol } from '../symbols'; import { Node } from './node'; @@ -23,7 +23,9 @@ export class ConditionGroup implements IPublicModelExclusiveGroup { } setVisible(node: IPublicModelNode) { - this[conditionGroupSymbol]?.setVisible((node as any)[nodeSymbol] ? (node as any)[nodeSymbol] : node); + this[conditionGroupSymbol]?.setVisible( + (node as any)[nodeSymbol] ? (node as any)[nodeSymbol] : node, + ); } static create(conditionGroup: IExclusiveGroup | null) { diff --git a/packages/shell/src/model/detecting.ts b/packages/shell/src/model/detecting.ts index 7ce0fe1e5c..55841788cc 100644 --- a/packages/shell/src/model/detecting.ts +++ b/packages/shell/src/model/detecting.ts @@ -3,9 +3,13 @@ import { Detecting as InnerDetecting, IDocumentModel as InnerDocumentModel, INode as InnerNode, -} from '@alilc/lowcode-designer'; +} from '@felce/lowcode-designer'; import { documentSymbol, detectingSymbol } from '../symbols'; -import { IPublicModelDetecting, IPublicModelNode, IPublicTypeDisposable } from '@alilc/lowcode-types'; +import { + IPublicModelDetecting, + IPublicModelNode, + IPublicTypeDisposable, +} from '@felce/lowcode-types'; export class Detecting implements IPublicModelDetecting { private readonly [documentSymbol]: InnerDocumentModel; @@ -60,4 +64,4 @@ export class Detecting implements IPublicModelDetecting { }; return this[detectingSymbol].onDetectingChange(innerFn); } -} \ No newline at end of file +} diff --git a/packages/shell/src/model/document-model.ts b/packages/shell/src/model/document-model.ts index bd0ccaf75e..5fbaeae740 100644 --- a/packages/shell/src/model/document-model.ts +++ b/packages/shell/src/model/document-model.ts @@ -1,7 +1,4 @@ -import { - IDocumentModel as InnerDocumentModel, - INode as InnerNode, -} from '@alilc/lowcode-designer'; +import { IDocumentModel as InnerDocumentModel, INode as InnerNode } from '@felce/lowcode-designer'; import { IPublicEnumTransformStage, IPublicTypeRootSchema, @@ -22,8 +19,8 @@ import { IPublicTypeDisposable, IPublicModelEditor, IPublicTypeNodeSchema, -} from '@alilc/lowcode-types'; -import { isDragNodeObject } from '@alilc/lowcode-utils'; +} from '@felce/lowcode-types'; +import { isDragNodeObject } from '@felce/lowcode-utils'; import { Node as ShellNode } from './node'; import { Selection as ShellSelection } from './selection'; import { Detecting as ShellDetecting } from './detecting'; @@ -108,10 +105,10 @@ export class DocumentModel implements IPublicModelDocumentModel { set focusNode(node: IPublicModelNode | null) { this._focusNode = node; - this[editorSymbol].eventBus.emit( - 'shell.document.focusNodeChanged', - { document: this, focusNode: node }, - ); + this[editorSymbol].eventBus.emit('shell.document.focusNodeChanged', { + document: this, + focusNode: node, + }); } /** @@ -164,7 +161,9 @@ export class DocumentModel implements IPublicModelDocumentModel { * @param stage * @returns */ - exportSchema(stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Render): IPublicTypeRootSchema | undefined { + exportSchema( + stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Render, + ): IPublicTypeRootSchema | undefined { return this[documentSymbol].export(stage); } @@ -224,14 +223,14 @@ export class DocumentModel implements IPublicModelDocumentModel { * @returns boolean 是否可以放置 */ checkNesting( - dropTarget: IPublicModelNode, - dragObject: IPublicTypeDragNodeObject | IPublicTypeDragNodeDataObject, - ): boolean { + dropTarget: IPublicModelNode, + dragObject: IPublicTypeDragNodeObject | IPublicTypeDragNodeDataObject, + ): boolean { let innerDragObject = dragObject; if (isDragNodeObject(dragObject)) { innerDragObject.nodes = innerDragObject.nodes?.map( - (node: IPublicModelNode) => ((node as any)[nodeSymbol] || node), - ); + (node: IPublicModelNode) => (node as any)[nodeSymbol] || node, + ); } return this[documentSymbol].checkNesting( ((dropTarget as any)[nodeSymbol] || dropTarget) as any, @@ -252,9 +251,7 @@ export class DocumentModel implements IPublicModelDocumentModel { * 当前 document 新增节点事件,此时节点已经挂载到 document 上 */ onMountNode(fn: (payload: { node: IPublicModelNode }) => void): IPublicTypeDisposable { - return this[documentSymbol].onMountNode(({ - node, - }) => { + return this[documentSymbol].onMountNode(({ node }) => { fn({ node: ShellNode.create(node)! }); }); } @@ -290,7 +287,9 @@ export class DocumentModel implements IPublicModelDocumentModel { * 当前 document 的节点显隐状态变更事件 * @param fn */ - onChangeNodeVisible(fn: (node: IPublicModelNode, visible: boolean) => void): IPublicTypeDisposable { + onChangeNodeVisible( + fn: (node: IPublicModelNode, visible: boolean) => void, + ): IPublicTypeDisposable { return this[documentSymbol].onChangeNodeVisible((node: InnerNode, visible: boolean) => { fn(ShellNode.create(node)!, visible); }); @@ -301,15 +300,17 @@ export class DocumentModel implements IPublicModelDocumentModel { * @param fn */ onChangeNodeChildren(fn: (info: IPublicTypeOnChangeOptions) => void): IPublicTypeDisposable { - return this[documentSymbol].onChangeNodeChildren((info?: IPublicTypeOnChangeOptions<InnerNode>) => { - if (!info) { - return; - } - fn({ - type: info.type, - node: ShellNode.create(info.node)!, - }); - }); + return this[documentSymbol].onChangeNodeChildren( + (info?: IPublicTypeOnChangeOptions<InnerNode>) => { + if (!info) { + return; + } + fn({ + type: info.type, + node: ShellNode.create(info.node)!, + }); + }, + ); } /** @@ -326,16 +327,10 @@ export class DocumentModel implements IPublicModelDocumentModel { node: ShellNode.create(info.node as any)!, }); }; - this[editorSymbol].on( - GlobalEvent.Node.Prop.InnerChange, - callback, - ); + this[editorSymbol].on(GlobalEvent.Node.Prop.InnerChange, callback); return () => { - this[editorSymbol].off( - GlobalEvent.Node.Prop.InnerChange, - callback, - ); + this[editorSymbol].off(GlobalEvent.Node.Prop.InnerChange, callback); }; } @@ -357,25 +352,19 @@ export class DocumentModel implements IPublicModelDocumentModel { if (!fn) { return () => {}; } - return this[editorSymbol].eventBus.on( - 'shell.document.focusNodeChanged', - (payload) => { - const { document, focusNode } = payload; - fn(document, focusNode); - }, - ); + return this[editorSymbol].eventBus.on('shell.document.focusNodeChanged', (payload) => { + const { document, focusNode } = payload; + fn(document, focusNode); + }); } onDropLocationChanged(fn: (doc: IPublicModelDocumentModel) => void): IPublicTypeDisposable { if (!fn) { return () => {}; } - return this[editorSymbol].eventBus.on( - 'document.dropLocation.changed', - (payload) => { - const { document } = payload; - fn(document); - }, - ); + return this[editorSymbol].eventBus.on('document.dropLocation.changed', (payload) => { + const { document } = payload; + fn(document); + }); } } diff --git a/packages/shell/src/model/drag-object.ts b/packages/shell/src/model/drag-object.ts index 064680fdee..1a232c356b 100644 --- a/packages/shell/src/model/drag-object.ts +++ b/packages/shell/src/model/drag-object.ts @@ -1,5 +1,10 @@ import { dragObjectSymbol } from '../symbols'; -import { IPublicModelDragObject, IPublicModelDragObject as InnerDragObject, IPublicTypeDragNodeDataObject, IPublicTypeNodeSchema } from '@alilc/lowcode-types'; +import { + IPublicModelDragObject, + IPublicModelDragObject as InnerDragObject, + IPublicTypeDragNodeDataObject, + IPublicTypeNodeSchema, +} from '@felce/lowcode-types'; import { Node } from './node'; export class DragObject implements IPublicModelDragObject { @@ -31,4 +36,4 @@ export class DragObject implements IPublicModelDragObject { get data(): IPublicTypeNodeSchema | IPublicTypeNodeSchema[] { return (this[dragObjectSymbol] as IPublicTypeDragNodeDataObject).data; } -} \ No newline at end of file +} diff --git a/packages/shell/src/model/dragon.ts b/packages/shell/src/model/dragon.ts index 7f2492e7ea..57ac539f10 100644 --- a/packages/shell/src/model/dragon.ts +++ b/packages/shell/src/model/dragon.ts @@ -1,12 +1,8 @@ -import { - IDragon, - ILocateEvent as InnerLocateEvent, - INode, -} from '@alilc/lowcode-designer'; +import { IDragon, ILocateEvent as InnerLocateEvent, INode } from '@felce/lowcode-designer'; import { dragonSymbol, nodeSymbol } from '../symbols'; import LocateEvent from './locate-event'; import { DragObject } from './drag-object'; -import { globalContext } from '@alilc/lowcode-editor-core'; +import { globalContext } from '@felce/lowcode-editor-core'; import { IPublicModelDragon, IPublicModelLocateEvent, @@ -14,14 +10,17 @@ import { IPublicTypeDragNodeDataObject, IPublicModelNode, IPublicTypeDragObject, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; export const innerDragonSymbol = Symbol('innerDragonSymbol'); export class Dragon implements IPublicModelDragon { private readonly [innerDragonSymbol]: IDragon; - constructor(innerDragon: IDragon, readonly workspaceMode: boolean) { + constructor( + innerDragon: IDragon, + readonly workspaceMode: boolean, + ) { this[innerDragonSymbol] = innerDragon; } @@ -40,10 +39,7 @@ export class Dragon implements IPublicModelDragon { return designer.dragon; } - static create( - dragon: IDragon | null, - workspaceMode: boolean, - ): IPublicModelDragon | null { + static create(dragon: IDragon | null, workspaceMode: boolean): IPublicModelDragon | null { if (!dragon) { return null; } @@ -105,13 +101,21 @@ export class Dragon implements IPublicModelDragon { * @param dragObject 拖拽对象 * @param boostEvent 拖拽初始时事件 */ - boost(dragObject: IPublicTypeDragObject, boostEvent: MouseEvent | DragEvent, fromRglNode?: IPublicModelNode & { - [nodeSymbol]: INode; - }): void { - return this[dragonSymbol].boost({ - ...dragObject, - nodes: dragObject.nodes.map((node: any) => node[nodeSymbol]), - }, boostEvent, fromRglNode?.[nodeSymbol]); + boost( + dragObject: IPublicTypeDragObject, + boostEvent: MouseEvent | DragEvent, + fromRglNode?: IPublicModelNode & { + [nodeSymbol]: INode; + }, + ): void { + return this[dragonSymbol].boost( + { + ...dragObject, + nodes: dragObject.nodes.map((node: any) => node[nodeSymbol]), + }, + boostEvent, + fromRglNode?.[nodeSymbol], + ); } /** diff --git a/packages/shell/src/model/drop-location.ts b/packages/shell/src/model/drop-location.ts index f38e74a07a..3df7c192d7 100644 --- a/packages/shell/src/model/drop-location.ts +++ b/packages/shell/src/model/drop-location.ts @@ -1,9 +1,11 @@ -import { - IDropLocation as InnerDropLocation, -} from '@alilc/lowcode-designer'; +import { IDropLocation as InnerDropLocation } from '@felce/lowcode-designer'; import { dropLocationSymbol } from '../symbols'; import { Node as ShellNode } from './node'; -import { IPublicModelDropLocation, IPublicTypeLocationDetail, IPublicModelLocateEvent } from '@alilc/lowcode-types'; +import { + IPublicModelDropLocation, + IPublicTypeLocationDetail, + IPublicModelLocateEvent, +} from '@felce/lowcode-types'; export class DropLocation implements IPublicModelDropLocation { private readonly [dropLocationSymbol]: InnerDropLocation; diff --git a/packages/shell/src/model/editor-view.ts b/packages/shell/src/model/editor-view.ts index 92d1a57726..6720197801 100644 --- a/packages/shell/src/model/editor-view.ts +++ b/packages/shell/src/model/editor-view.ts @@ -1,6 +1,6 @@ import { editorViewSymbol, pluginContextSymbol } from '../symbols'; -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; -import { IViewContext } from '@alilc/lowcode-workspace'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; +import { IViewContext } from '@felce/lowcode-workspace'; export class EditorView { [editorViewSymbol]: IViewContext; diff --git a/packages/shell/src/model/history.ts b/packages/shell/src/model/history.ts index ddc567aeef..427cb11d53 100644 --- a/packages/shell/src/model/history.ts +++ b/packages/shell/src/model/history.ts @@ -1,6 +1,9 @@ -import type { IDocumentModel as InnerDocumentModel, IHistory as InnerHistory } from '@alilc/lowcode-designer'; +import type { + IDocumentModel as InnerDocumentModel, + IHistory as InnerHistory, +} from '@felce/lowcode-designer'; import { historySymbol, documentSymbol } from '../symbols'; -import { IPublicModelHistory, IPublicTypeDisposable } from '@alilc/lowcode-types'; +import { IPublicModelHistory, IPublicTypeDisposable } from '@felce/lowcode-types'; export class History implements IPublicModelHistory { private readonly [documentSymbol]: InnerDocumentModel; diff --git a/packages/shell/src/model/locate-event.ts b/packages/shell/src/model/locate-event.ts index 20451f9462..0b8624a17f 100644 --- a/packages/shell/src/model/locate-event.ts +++ b/packages/shell/src/model/locate-event.ts @@ -1,7 +1,7 @@ -import { ILocateEvent } from '@alilc/lowcode-designer'; +import { ILocateEvent } from '@felce/lowcode-designer'; import { locateEventSymbol } from '../symbols'; import { DragObject } from './drag-object'; -import { IPublicModelLocateEvent, IPublicModelDragObject } from '@alilc/lowcode-types'; +import { IPublicModelLocateEvent, IPublicModelDragObject } from '@felce/lowcode-types'; export default class LocateEvent implements IPublicModelLocateEvent { private readonly [locateEventSymbol]: ILocateEvent; @@ -48,4 +48,4 @@ export default class LocateEvent implements IPublicModelLocateEvent { get dragObject(): IPublicModelDragObject | null { return DragObject.create(this[locateEventSymbol].dragObject); } -} \ No newline at end of file +} diff --git a/packages/shell/src/model/modal-nodes-manager.ts b/packages/shell/src/model/modal-nodes-manager.ts index b1e27596f2..f8fa93e27a 100644 --- a/packages/shell/src/model/modal-nodes-manager.ts +++ b/packages/shell/src/model/modal-nodes-manager.ts @@ -1,8 +1,8 @@ import { IModalNodesManager as InnerModalNodesManager, INode as InnerNode, -} from '@alilc/lowcode-designer'; -import { IPublicModelModalNodesManager, IPublicModelNode } from '@alilc/lowcode-types'; +} from '@felce/lowcode-designer'; +import { IPublicModelModalNodesManager, IPublicModelNode } from '@felce/lowcode-types'; import { Node as ShellNode } from './node'; import { nodeSymbol, modalNodesManagerSymbol } from '../symbols'; @@ -70,7 +70,7 @@ export class ModalNodesManager implements IPublicModelModalNodesManager { * 设置指定节点为不可见态 * @param node Node */ - setInvisible(node: IPublicModelNode): void { + setInvisible(node: IPublicModelNode): void { this[modalNodesManagerSymbol].setInvisible((node as any)[nodeSymbol]); } -} \ No newline at end of file +} diff --git a/packages/shell/src/model/node-children.ts b/packages/shell/src/model/node-children.ts index b6d52e86fe..3bf8d29872 100644 --- a/packages/shell/src/model/node-children.ts +++ b/packages/shell/src/model/node-children.ts @@ -1,5 +1,10 @@ -import { INode as InnerNode, INodeChildren } from '@alilc/lowcode-designer'; -import { IPublicTypeNodeData, IPublicEnumTransformStage, IPublicModelNodeChildren, IPublicModelNode } from '@alilc/lowcode-types'; +import { INode as InnerNode, INodeChildren } from '@felce/lowcode-designer'; +import { + IPublicTypeNodeData, + IPublicEnumTransformStage, + IPublicModelNodeChildren, + IPublicModelNode, +} from '@felce/lowcode-types'; import { Node as ShellNode } from './node'; import { nodeSymbol, nodeChildrenSymbol } from '../symbols'; @@ -133,7 +138,7 @@ export class NodeChildren implements IPublicModelNodeChildren { * 类似数组的 reverse */ reverse(): IPublicModelNode[] { - return this[nodeChildrenSymbol].reverse().map(d => { + return this[nodeChildrenSymbol].reverse().map((d) => { return ShellNode.create(d)!; }); } diff --git a/packages/shell/src/model/node.ts b/packages/shell/src/model/node.ts index 29d24232eb..726670c1d6 100644 --- a/packages/shell/src/model/node.ts +++ b/packages/shell/src/model/node.ts @@ -1,7 +1,4 @@ -import { - IDocumentModel as InnerDocumentModel, - INode as InnerNode, -} from '@alilc/lowcode-designer'; +import { IDocumentModel as InnerDocumentModel, INode as InnerNode } from '@felce/lowcode-designer'; import { IPublicTypeCompositeValue, IPublicTypeNodeSchema, @@ -18,7 +15,7 @@ import { IPublicTypePropsList, IPublicModelSettingTopEntry, IPublicModelExclusiveGroup, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { Prop as ShellProp } from './prop'; import { Props as ShellProps } from './props'; import { DocumentModel as ShellDocumentModel } from './document-model'; @@ -518,9 +515,9 @@ export class Node implements IPublicModelNode { * @returns */ exportSchema( - stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Render, - options?: any, - ): IPublicTypeNodeSchema { + stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Render, + options?: any, + ): IPublicTypeNodeSchema { return this[nodeSymbol].export(stage, options); } @@ -531,15 +528,15 @@ export class Node implements IPublicModelNode { * @param useMutator */ insertBefore( - node: IPublicModelNode, - ref?: IPublicModelNode | undefined, - useMutator?: boolean, - ): void { + node: IPublicModelNode, + ref?: IPublicModelNode | undefined, + useMutator?: boolean, + ): void { this[nodeSymbol].insertBefore( - (node as any)[nodeSymbol] || node, - (ref as any)?.[nodeSymbol], - useMutator, - ); + (node as any)[nodeSymbol] || node, + (ref as any)?.[nodeSymbol], + useMutator, + ); } /** @@ -549,15 +546,15 @@ export class Node implements IPublicModelNode { * @param useMutator */ insertAfter( - node: IPublicModelNode, - ref?: IPublicModelNode | undefined, - useMutator?: boolean, - ): void { + node: IPublicModelNode, + ref?: IPublicModelNode | undefined, + useMutator?: boolean, + ): void { this[nodeSymbol].insertAfter( - (node as any)[nodeSymbol] || node, - (ref as any)?.[nodeSymbol], - useMutator, - ); + (node as any)[nodeSymbol] || node, + (ref as any)?.[nodeSymbol], + useMutator, + ); } /** @@ -657,14 +654,8 @@ export class Node implements IPublicModelNode { } getRGL() { - const { - isContainerNode, - isEmptyNode, - isRGLContainerNode, - isRGLNode, - isRGL, - rglNode, - } = this[nodeSymbol].getRGL(); + const { isContainerNode, isEmptyNode, isRGLContainerNode, isRGLNode, isRGL, rglNode } = + this[nodeSymbol].getRGL(); return { isContainerNode, diff --git a/packages/shell/src/model/plugin-instance.ts b/packages/shell/src/model/plugin-instance.ts index 156ec7579c..58fbc6a4d2 100644 --- a/packages/shell/src/model/plugin-instance.ts +++ b/packages/shell/src/model/plugin-instance.ts @@ -1,5 +1,5 @@ -import { ILowCodePluginRuntime } from '@alilc/lowcode-designer'; -import { IPublicModelPluginInstance } from '@alilc/lowcode-types'; +import { ILowCodePluginRuntime } from '@felce/lowcode-designer'; +import { IPublicModelPluginInstance } from '@felce/lowcode-types'; import { pluginInstanceSymbol } from '../symbols'; export class PluginInstance implements IPublicModelPluginInstance { diff --git a/packages/shell/src/model/prop.ts b/packages/shell/src/model/prop.ts index 8d4ca7842e..df299a14c9 100644 --- a/packages/shell/src/model/prop.ts +++ b/packages/shell/src/model/prop.ts @@ -1,5 +1,10 @@ -import { IProp as InnerProp } from '@alilc/lowcode-designer'; -import { IPublicTypeCompositeValue, IPublicEnumTransformStage, IPublicModelProp, IPublicModelNode } from '@alilc/lowcode-types'; +import { IProp as InnerProp } from '@felce/lowcode-designer'; +import { + IPublicTypeCompositeValue, + IPublicEnumTransformStage, + IPublicModelProp, + IPublicModelNode, +} from '@felce/lowcode-types'; import { propSymbol } from '../symbols'; import { Node as ShellNode } from './node'; @@ -91,4 +96,4 @@ export class Prop implements IPublicModelProp { exportSchema(stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Render) { return this[propSymbol].export(stage); } -} \ No newline at end of file +} diff --git a/packages/shell/src/model/props.ts b/packages/shell/src/model/props.ts index 86a9a2142b..f23286ff5b 100644 --- a/packages/shell/src/model/props.ts +++ b/packages/shell/src/model/props.ts @@ -1,5 +1,10 @@ -import { IProps as InnerProps, getConvertedExtraKey } from '@alilc/lowcode-designer'; -import { IPublicTypeCompositeValue, IPublicModelProps, IPublicModelNode, IPublicModelProp } from '@alilc/lowcode-types'; +import { IProps as InnerProps, getConvertedExtraKey } from '@felce/lowcode-designer'; +import { + IPublicTypeCompositeValue, + IPublicModelProps, + IPublicModelNode, + IPublicModelProp, +} from '@felce/lowcode-types'; import { propsSymbol } from '../symbols'; import { Node as ShellNode } from './node'; import { Prop as ShellProp } from './prop'; @@ -115,4 +120,4 @@ export class Props implements IPublicModelProps { add(value: IPublicTypeCompositeValue, key?: string | number | undefined): any { return this[propsSymbol].add(value, key); } -} \ No newline at end of file +} diff --git a/packages/shell/src/model/resource.ts b/packages/shell/src/model/resource.ts index 29a385b993..599e51560d 100644 --- a/packages/shell/src/model/resource.ts +++ b/packages/shell/src/model/resource.ts @@ -1,5 +1,5 @@ -import { IPublicModelResource } from '@alilc/lowcode-types'; -import { IResource } from '@alilc/lowcode-workspace'; +import { IPublicModelResource } from '@felce/lowcode-types'; +import { IResource } from '@felce/lowcode-workspace'; import { resourceSymbol } from '../symbols'; export class Resource implements IPublicModelResource { @@ -52,4 +52,4 @@ export class Resource implements IPublicModelResource { get viewName() { return this[resourceSymbol].viewName; } -} \ No newline at end of file +} diff --git a/packages/shell/src/model/selection.ts b/packages/shell/src/model/selection.ts index 073083a650..40eedfd5e1 100644 --- a/packages/shell/src/model/selection.ts +++ b/packages/shell/src/model/selection.ts @@ -2,10 +2,14 @@ import { IDocumentModel as InnerDocumentModel, INode as InnerNode, ISelection, -} from '@alilc/lowcode-designer'; +} from '@felce/lowcode-designer'; import { Node as ShellNode } from './node'; import { selectionSymbol } from '../symbols'; -import { IPublicModelSelection, IPublicModelNode, IPublicTypeDisposable } from '@alilc/lowcode-types'; +import { + IPublicModelSelection, + IPublicModelNode, + IPublicTypeDisposable, +} from '@felce/lowcode-types'; export class Selection implements IPublicModelSelection { private readonly [selectionSymbol]: ISelection; diff --git a/packages/shell/src/model/setting-field.ts b/packages/shell/src/model/setting-field.ts index ffc97ccc8f..4057e505eb 100644 --- a/packages/shell/src/model/setting-field.ts +++ b/packages/shell/src/model/setting-field.ts @@ -1,4 +1,4 @@ -import { ISettingField, isSettingField } from '@alilc/lowcode-designer'; +import { ISettingField, isSettingField } from '@felce/lowcode-designer'; import { IPublicTypeCompositeValue, IPublicTypeFieldConfig, @@ -11,12 +11,12 @@ import { IPublicTypeSetValueOptions, IPublicModelSettingField, IPublicTypeDisposable, -} from '@alilc/lowcode-types'; +} from '@felce/lowcode-types'; import { settingFieldSymbol } from '../symbols'; import { Node as ShellNode } from './node'; import { SettingTopEntry, SettingTopEntry as ShellSettingTopEntry } from './setting-top-entry'; import { ComponentMeta as ShellComponentMeta } from './component-meta'; -import { isCustomView } from '@alilc/lowcode-utils'; +import { isCustomView } from '@felce/lowcode-utils'; export class SettingField implements IPublicModelSettingField { private readonly [settingFieldSymbol]: ISettingField; diff --git a/packages/shell/src/model/setting-top-entry.ts b/packages/shell/src/model/setting-top-entry.ts index 8afed43a50..ea4f7ce396 100644 --- a/packages/shell/src/model/setting-top-entry.ts +++ b/packages/shell/src/model/setting-top-entry.ts @@ -1,7 +1,11 @@ -import { ISettingTopEntry } from '@alilc/lowcode-designer'; +import { ISettingTopEntry } from '@felce/lowcode-designer'; import { settingTopEntrySymbol } from '../symbols'; import { Node as ShellNode } from './node'; -import { IPublicModelSettingTopEntry, IPublicModelNode, IPublicModelSettingField } from '@alilc/lowcode-types'; +import { + IPublicModelSettingTopEntry, + IPublicModelNode, + IPublicModelSettingField, +} from '@felce/lowcode-types'; import { SettingField } from './setting-field'; export class SettingTopEntry implements IPublicModelSettingTopEntry { @@ -59,4 +63,4 @@ export class SettingTopEntry implements IPublicModelSettingTopEntry { clearPropValue(propName: string | number) { this[settingTopEntrySymbol].clearPropValue(propName); } -} \ No newline at end of file +} diff --git a/packages/shell/src/model/simulator-render.ts b/packages/shell/src/model/simulator-render.ts index f6ae47996c..076dfca93a 100644 --- a/packages/shell/src/model/simulator-render.ts +++ b/packages/shell/src/model/simulator-render.ts @@ -1,6 +1,6 @@ -import { IPublicModelSimulatorRender } from '@alilc/lowcode-types'; +import { IPublicModelSimulatorRender } from '@felce/lowcode-types'; import { simulatorRenderSymbol } from '../symbols'; -import { BuiltinSimulatorRenderer } from '@alilc/lowcode-designer'; +import { BuiltinSimulatorRenderer } from '@felce/lowcode-designer'; export class SimulatorRender implements IPublicModelSimulatorRender { private readonly [simulatorRenderSymbol]: BuiltinSimulatorRenderer; @@ -20,4 +20,4 @@ export class SimulatorRender implements IPublicModelSimulatorRender { rerender() { return this[simulatorRenderSymbol].rerender(); } -} \ No newline at end of file +} diff --git a/packages/shell/src/model/skeleton-item.ts b/packages/shell/src/model/skeleton-item.ts index 7f1224c0d9..5465536204 100644 --- a/packages/shell/src/model/skeleton-item.ts +++ b/packages/shell/src/model/skeleton-item.ts @@ -1,6 +1,6 @@ import { skeletonItemSymbol } from '../symbols'; -import { IPublicModelSkeletonItem } from '@alilc/lowcode-types'; -import { Dock, IWidget, Panel, PanelDock, Stage, Widget } from '@alilc/lowcode-editor-skeleton'; +import { IPublicModelSkeletonItem } from '@felce/lowcode-types'; +import { Dock, IWidget, Panel, PanelDock, Stage, Widget } from '@felce/lowcode-editor-skeleton'; export class SkeletonItem implements IPublicModelSkeletonItem { private [skeletonItemSymbol]: IWidget | Widget | Panel | Stage | Dock | PanelDock; @@ -36,4 +36,4 @@ export class SkeletonItem implements IPublicModelSkeletonItem { toggle() { this[skeletonItemSymbol].toggle(); } -} \ No newline at end of file +} diff --git a/packages/shell/src/model/window.ts b/packages/shell/src/model/window.ts index 1bc84e661c..5d20bcbbb3 100644 --- a/packages/shell/src/model/window.ts +++ b/packages/shell/src/model/window.ts @@ -1,6 +1,10 @@ import { windowSymbol } from '../symbols'; -import { IPublicModelResource, IPublicModelWindow, IPublicTypeDisposable } from '@alilc/lowcode-types'; -import { IEditorWindow } from '@alilc/lowcode-workspace'; +import { + IPublicModelResource, + IPublicModelWindow, + IPublicTypeDisposable, +} from '@felce/lowcode-types'; +import { IEditorWindow } from '@felce/lowcode-workspace'; import { Resource as ShellResource } from './resource'; import { EditorView } from './editor-view'; @@ -55,6 +59,8 @@ export class Window implements IPublicModelWindow { } get editorViews() { - return Array.from(this[windowSymbol].editorViews.values()).map(d => new EditorView(d).toProxy() as any); + return Array.from(this[windowSymbol].editorViews.values()).map( + (d) => new EditorView(d).toProxy() as any, + ); } } diff --git a/packages/shell/tsconfig.json b/packages/shell/tsconfig.json new file mode 100644 index 0000000000..c37b76ecc6 --- /dev/null +++ b/packages/shell/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "lib" + }, + "include": [ + "./src/" + ] +} diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md deleted file mode 100644 index 5513b477aa..0000000000 --- a/packages/types/CHANGELOG.md +++ /dev/null @@ -1,1535 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.0.55](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.54...v1.0.55) (2021-06-17) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.54](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.53...v1.0.54) (2021-06-08) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.53](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.52...v1.0.53) (2021-06-07) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.52](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.51...v1.0.52) (2021-06-07) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.51](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.49...v1.0.51) (2021-06-03) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.49](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.48...v1.0.49) (2021-05-20) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.48](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.48-beta.4...v1.0.48) (2021-05-17) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.48-beta.4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.48-beta.3...v1.0.48-beta.4) (2021-05-14) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.48-beta.3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.48-beta.2...v1.0.48-beta.3) (2021-05-13) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.48-beta.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.48-beta.1...v1.0.48-beta.2) (2021-05-12) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.48-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.48-beta.0...v1.0.48-beta.1) (2021-05-12) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.48-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.47...v1.0.48-beta.0) (2021-05-11) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.47](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.47-beta.1...v1.0.47) (2021-04-28) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.47-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.47-beta.0...v1.0.47-beta.1) (2021-04-28) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.47-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.46...v1.0.47-beta.0) (2021-04-28) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.46](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.46-beta.0...v1.0.46) (2021-04-27) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.46-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.45...v1.0.46-beta.0) (2021-04-25) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.45](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.45-beta.1...v1.0.45) (2021-04-23) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.45-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.45-beta.0...v1.0.45-beta.1) (2021-04-22) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.45-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.44...v1.0.45-beta.0) (2021-04-21) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.44](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.44-beta.2...v1.0.44) (2021-04-14) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.44-beta.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.44-beta.1...v1.0.44-beta.2) (2021-04-14) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.44-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.44-beta.0...v1.0.44-beta.1) (2021-04-14) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.44-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.43...v1.0.44-beta.0) (2021-04-13) - - -### Bug Fixes - -* componentsMap 中加入低代码组件信息 ([b7c1183](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b7c11834602d8e4ea84d2dea035a3abf97b33d5c)) - - - - - -## [1.0.43](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.43-beta.0...v1.0.43) (2021-04-13) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.43-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.42...v1.0.43-beta.0) (2021-04-13) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.42](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.42-beta.1...v1.0.42) (2021-04-06) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.42-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.42-beta.0...v1.0.42-beta.1) (2021-04-06) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.42-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.41...v1.0.42-beta.0) (2021-04-06) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.41](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.41-beta.1...v1.0.41) (2021-04-06) - - -### Bug Fixes - -* bypass dataSource ([3cb331d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/3cb331dcbeee62959ef0b1614c6c3cb2bd3c1a3e)) - - - - - -## [1.0.41-beta.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.41-beta.1...v1.0.41-beta.2) (2021-04-06) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.41-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.41-beta.0...v1.0.41-beta.1) (2021-04-06) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.41-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.40...v1.0.41-beta.0) (2021-04-02) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.40](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.40-beta.1...v1.0.40) (2021-03-31) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.40-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.40-beta.0...v1.0.40-beta.1) (2021-03-31) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.40-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.39-beta.5...v1.0.40-beta.0) (2021-03-31) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.39-beta.5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.39-beta.4...v1.0.39-beta.5) (2021-03-31) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.39-beta.4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.39-beta.3...v1.0.39-beta.4) (2021-03-30) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.39-beta.3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.39-beta.2...v1.0.39-beta.3) (2021-03-22) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.39-beta.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.39-beta.1...v1.0.39-beta.2) (2021-03-22) - - -### Bug Fixes - -* renderer-core 在非设计渲染态时, 不应处理 hidden 属性 ([7857096](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7857096c0f56308195cc9e27de4f549eee72a10e)) - - - - - -## [1.0.39-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.38-beta.3...v1.0.39-beta.1) (2021-03-12) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.39-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.38-beta.3...v1.0.39-beta.0) (2021-03-12) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.38-beta.3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.38-beta.1...v1.0.38-beta.3) (2021-03-11) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.38-beta.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.38-beta.1...v1.0.38-beta.2) (2021-03-11) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.38-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.38-beta.0...v1.0.38-beta.1) (2021-03-09) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.38-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.37...v1.0.38-beta.0) (2021-03-08) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.37](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.37-beta.6...v1.0.37) (2021-03-05) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - - - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.37](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.37-beta.6...v1.0.37) (2021-03-05) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.37-beta.6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.37-beta.3...v1.0.37-beta.6) (2021-03-03) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.37-beta.5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.37-beta.4...v1.0.37-beta.5) (2021-02-24) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.37-beta.4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.37-beta.3...v1.0.37-beta.4) (2021-02-24) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -## [1.0.37-beta.3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.37-beta.2...v1.0.37-beta.3) (2021-02-24) - -**Note:** Version bump only for package @ali/lowcode-types - - - - - -<a name="1.0.37-beta.2"></a> -## [1.0.37-beta.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.37-beta.1...v1.0.37-beta.2) (2021-02-23) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.37-beta.1"></a> -## [1.0.37-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.36...v1.0.37-beta.1) (2021-02-23) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.36"></a> -## [1.0.36](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.36-beta.0...v1.0.36) (2021-02-04) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.36-beta.0"></a> -## [1.0.36-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.35...v1.0.36-beta.0) (2021-02-04) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.35"></a> -## [1.0.35](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.35-beta.1...v1.0.35) (2021-02-03) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.35-beta.1"></a> -## [1.0.35-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.35-beta.0...v1.0.35-beta.1) (2021-02-03) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.35-beta.0"></a> -## [1.0.35-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.33...v1.0.35-beta.0) (2021-02-01) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.33"></a> -## [1.0.33](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.33-beta.1...v1.0.33) (2021-01-29) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.33-beta.1"></a> -## [1.0.33-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.33-beta.0...v1.0.33-beta.1) (2021-01-28) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.33-beta.0"></a> -## [1.0.33-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.32...v1.0.33-beta.0) (2021-01-28) - - -### Bug Fixes - -* 修复从其他页面粘贴过来的 modal 位置不对 ([158b6a6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/158b6a6)) - - - - -<a name="1.0.32"></a> -## [1.0.32](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.32-beta.2...v1.0.32) (2021-01-26) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.32-beta.2"></a> -## [1.0.32-beta.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.32-beta.0...v1.0.32-beta.2) (2021-01-26) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.32-beta.0"></a> -## [1.0.32-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.31...v1.0.32-beta.0) (2021-01-25) - - -### Features - -* meta 增加 hideSelectTools ([e7287d4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/e7287d4)) -* metadata 增加 canHovering 配置 ([88e128e](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/88e128e)) -* 增加 plugin 的 autoInit 注册方式 ([4f9be73](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/4f9be73)) - - - - -<a name="1.0.31"></a> -## [1.0.31](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.31-beta.1...v1.0.31) (2021-01-15) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.31-beta.1"></a> -## [1.0.31-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30...v1.0.31-beta.1) (2021-01-15) - - -### Bug Fixes - -* 延迟加载内置 setter ([99cbdd5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/99cbdd5)) - - - - -<a name="1.0.31-beta.0"></a> -## [1.0.31-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30...v1.0.31-beta.0) (2021-01-15) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.30"></a> -## [1.0.30](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30-beta.17...v1.0.30) (2021-01-14) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.30-beta.17"></a> -## [1.0.30-beta.17](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30-beta.16...v1.0.30-beta.17) (2021-01-14) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.30-beta.16"></a> -## [1.0.30-beta.16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30-beta.14...v1.0.30-beta.16) (2021-01-14) - - -### Features - -* 将 typings 在顶层导出 ([d2aed7d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/d2aed7d)) - - - - -<a name="1.0.30-beta.15"></a> -## [1.0.30-beta.15](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30-beta.14...v1.0.30-beta.15) (2021-01-13) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.30-beta.14"></a> -## [1.0.30-beta.14](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30-beta.13...v1.0.30-beta.14) (2021-01-13) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.30-beta.13"></a> -## [1.0.30-beta.13](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30-beta.12...v1.0.30-beta.13) (2021-01-13) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.30-beta.12"></a> -## [1.0.30-beta.12](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30-beta.11...v1.0.30-beta.12) (2021-01-13) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.30-beta.11"></a> -## [1.0.30-beta.11](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30-beta.10...v1.0.30-beta.11) (2021-01-12) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.30-beta.10"></a> -## [1.0.30-beta.10](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30-beta.9...v1.0.30-beta.10) (2021-01-12) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.30-beta.9"></a> -## [1.0.30-beta.9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30-beta.8...v1.0.30-beta.9) (2021-01-11) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.30-beta.8"></a> -## [1.0.30-beta.8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30-beta.7...v1.0.30-beta.8) (2021-01-11) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.30-beta.7"></a> -## [1.0.30-beta.7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.30-beta.6...v1.0.30-beta.7) (2021-01-11) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.30-beta.6"></a> -## [1.0.30-beta.6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.29...v1.0.30-beta.6) (2021-01-09) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.29"></a> -## [1.0.29](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.28-beta.2...v1.0.29) (2021-01-05) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.28-beta.2"></a> -## [1.0.28-beta.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.28-beta.1...v1.0.28-beta.2) (2021-01-04) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.28-beta.1"></a> -## [1.0.28-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.27...v1.0.28-beta.1) (2021-01-04) - - -### Features - -* 🎸 utils 的定义中增加对于 function 类型的支持 ([29b1daf](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/29b1daf)) -* 支持新版的 plugin 机制 ([1e8fc63](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/1e8fc63)) - - - - -<a name="1.0.28-beta.0"></a> -## [1.0.28-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.27...v1.0.28-beta.0) (2021-01-04) - - -### Features - -* 🎸 utils 的定义中增加对于 function 类型的支持 ([29b1daf](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/29b1daf)) -* 支持新版的 plugin 机制 ([1e8fc63](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/1e8fc63)) - - - - -<a name="1.0.27"></a> -## [1.0.27](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.27-beta.2...v1.0.27) (2020-12-24) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.27-beta.2"></a> -## [1.0.27-beta.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.27-beta.1...v1.0.27-beta.2) (2020-12-23) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.27-beta.1"></a> -## [1.0.27-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.27-beta.0...v1.0.27-beta.1) (2020-12-23) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.27-beta.0"></a> -## [1.0.27-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.26...v1.0.27-beta.0) (2020-12-23) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.26"></a> -## [1.0.26](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.26-beta.1...v1.0.26) (2020-12-22) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.26-beta.1"></a> -## [1.0.26-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.26-beta.0...v1.0.26-beta.1) (2020-12-22) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.26-beta.0"></a> -## [1.0.26-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.25-beta.1...v1.0.26-beta.0) (2020-12-22) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.25-beta.1"></a> -## [1.0.25-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.24-beta.4...v1.0.25-beta.1) (2020-12-15) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.24-beta.4"></a> -## [1.0.24-beta.4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.24-beta.3...v1.0.24-beta.4) (2020-12-14) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.24-beta.3"></a> -## [1.0.24-beta.3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.24-beta.2...v1.0.24-beta.3) (2020-12-11) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.24-beta.2"></a> -## [1.0.24-beta.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.24-beta.1...v1.0.24-beta.2) (2020-12-10) - - -### Bug Fixes - -* 删除无用代码, 解决 ts 编译报错 ([1f241ea](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/1f241ea)) - - - - -<a name="1.0.24-beta.1"></a> -## [1.0.24-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.24-beta.0...v1.0.24-beta.1) (2020-12-09) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.24-beta.0"></a> -## [1.0.24-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.23...v1.0.24-beta.0) (2020-12-09) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.23"></a> -## [1.0.23](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.23-beta.2...v1.0.23) (2020-12-08) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.23-beta.5"></a> -## [1.0.23-beta.5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.23-beta.4...v1.0.23-beta.5) (2020-12-08) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.23-beta.4"></a> -## [1.0.23-beta.4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.23-beta.3...v1.0.23-beta.4) (2020-12-08) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.23-beta.3"></a> -## [1.0.23-beta.3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.23-beta.2...v1.0.23-beta.3) (2020-12-08) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.23-beta.2"></a> -## [1.0.23-beta.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.23-beta.1...v1.0.23-beta.2) (2020-12-08) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.23-beta.1"></a> -## [1.0.23-beta.1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-29...v1.0.23-beta.1) (2020-12-07) - - -### Bug Fixes - -* 🐛 use lowcode types ([b11425b](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b11425b)) -* 🐛 根据低代码规范,数据源的配置中isInit和 type 都是有默认值的,所以应该是可选的 ([4baf0b4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/4baf0b4)) -* datasource版本错误问题 ([a247878](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/a247878)) -* fix test result ([7f6fbe8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7f6fbe8)) -* JSExpression 增加 compiled ([9f51e39](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/9f51e39)) -* miniAppBuildType config(temp) ([584b4c2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/584b4c2)) -* typo of onResizeEnd and remove ([8df5f05](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/8df5f05)) -* will fetch 按照协议修改 ([b9bf800](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b9bf800)) - - -### Features - -* 🎸 urlParams 类型的数据源不需要 options, 所以 options 改成可选为好 ([8114c6f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/8114c6f)) -* 🎸 按照中后台搭建协议规范文档补充 JSFunction 的定义和数据源定义中一些字段 ([8b1d0c7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/8b1d0c7)) -* 🎸 根据低代码协议文档, 完善UtilsMap的定义 ([7fe4bc0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7fe4bc0)) -* 🎸 根据低代码协议文档, 将 BlockSchema 也改成继承自 ContainerSchema ([7901c8e](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7901c8e)) -* 🎸 补充规范中定义的 JSFunction 类型 ([9e32525](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/9e32525)) -* split datasource types ([fd80698](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/fd80698)) -* update datasource engine ([cf3c7db](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/cf3c7db)) -* 合入 trunk-vision 代码 ([ea6bc7a](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ea6bc7a)) -* 调整 datasource-handlers ([2b9bcb5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/2b9bcb5)) - - - - -<a name="1.0.23-beta.0"></a> -## [1.0.23-beta.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-29...v1.0.23-beta.0) (2020-12-07) - - -### Bug Fixes - -* 🐛 use lowcode types ([b11425b](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b11425b)) -* 🐛 根据低代码规范,数据源的配置中isInit和 type 都是有默认值的,所以应该是可选的 ([4baf0b4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/4baf0b4)) -* datasource版本错误问题 ([a247878](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/a247878)) -* fix test result ([7f6fbe8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7f6fbe8)) -* JSExpression 增加 compiled ([9f51e39](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/9f51e39)) -* miniAppBuildType config(temp) ([584b4c2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/584b4c2)) -* typo of onResizeEnd and remove ([8df5f05](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/8df5f05)) -* will fetch 按照协议修改 ([b9bf800](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b9bf800)) - - -### Features - -* 🎸 urlParams 类型的数据源不需要 options, 所以 options 改成可选为好 ([8114c6f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/8114c6f)) -* 🎸 按照中后台搭建协议规范文档补充 JSFunction 的定义和数据源定义中一些字段 ([8b1d0c7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/8b1d0c7)) -* 🎸 根据低代码协议文档, 完善UtilsMap的定义 ([7fe4bc0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7fe4bc0)) -* 🎸 根据低代码协议文档, 将 BlockSchema 也改成继承自 ContainerSchema ([7901c8e](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7901c8e)) -* 🎸 补充规范中定义的 JSFunction 类型 ([9e32525](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/9e32525)) -* split datasource types ([fd80698](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/fd80698)) -* update datasource engine ([cf3c7db](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/cf3c7db)) -* 合入 trunk-vision 代码 ([ea6bc7a](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ea6bc7a)) -* 调整 datasource-handlers ([2b9bcb5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/2b9bcb5)) - - - - -<a name="1.0.20"></a> -## [1.0.20](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.19...@ali/lowcode-types@1.0.20) (2020-11-16) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.19"></a> -## [1.0.19](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.18...@ali/lowcode-types@1.0.19) (2020-11-10) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.18"></a> -## [1.0.18](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.17...@ali/lowcode-types@1.0.18) (2020-11-10) - - -### Bug Fixes - -* typo of onResizeEnd and remove ([8df5f05](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/8df5f05)) - - - - -<a name="1.0.17"></a> -## [1.0.17](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.16...@ali/lowcode-types@1.0.17) (2020-11-05) - - -### Bug Fixes - -* datasource版本错误问题 ([a247878](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/a247878)) - - -### Features - -* split datasource types ([fd80698](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/fd80698)) - - - - -<a name="1.0.16"></a> -## [1.0.16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.15...@ali/lowcode-types@1.0.16) (2020-11-05) -* 低成本方案支持绝对布局容器 ([a6067e8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/a6067e8)) - - - -<a name="0.12.1-18"></a> -## [0.12.1-18](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-17...v0.12.1-18) (2020-10-17) - - - -<a name="0.12.1-17"></a> -## [0.12.1-17](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-16...v0.12.1-17) (2020-10-14) - - - -<a name="0.12.1-16"></a> -## [0.12.1-16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-15...v0.12.1-16) (2020-10-12) - - - -<a name="0.12.1-15"></a> -## [0.12.1-15](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-1...v0.12.1-15) (2020-10-12) - - - -<a name="0.12.1-14"></a> -## [0.12.1-14](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-13...v0.12.1-14) (2020-10-10) - - - -<a name="0.12.1-13"></a> -## [0.12.1-13](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-12...v0.12.1-13) (2020-09-28) - - - -<a name="0.12.1-12"></a> -## [0.12.1-12](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-11...v0.12.1-12) (2020-09-28) - - - -<a name="0.12.1-11"></a> -## [0.12.1-11](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-10...v0.12.1-11) (2020-09-27) - - - -<a name="0.12.1-10"></a> -## [0.12.1-10](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-9...v0.12.1-10) (2020-09-27) - - - -<a name="0.12.1-9"></a> -## [0.12.1-9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-8...v0.12.1-9) (2020-09-27) - - - -<a name="0.12.1-8"></a> -## [0.12.1-8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-7...v0.12.1-8) (2020-09-27) - - - -<a name="0.12.1-7"></a> -## [0.12.1-7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-2...v0.12.1-7) (2020-09-27) - - - - -<a name="0.13.1-11"></a> -## [0.13.1-11](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-10...v0.13.1-11) (2020-11-02) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.13.1-10"></a> -## [0.13.1-10](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-9...v0.13.1-10) (2020-10-26) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.13.1-9"></a> -## [0.13.1-9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-7...v0.13.1-9) (2020-10-26) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.13.1-8"></a> -## [0.13.1-8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-7...v0.13.1-8) (2020-10-26) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.13.1-7"></a> -## [0.13.1-7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-6...v0.13.1-7) (2020-10-23) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.13.1-6"></a> -## [0.13.1-6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-5...v0.13.1-6) (2020-10-22) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.13.1-5"></a> -## [0.13.1-5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-4...v0.13.1-5) (2020-10-20) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.13.1-4"></a> -## [0.13.1-4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-3...v0.13.1-4) (2020-10-20) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.13.1-3"></a> -## [0.13.1-3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-2...v0.13.1-3) (2020-10-19) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.13.1-2"></a> -## [0.13.1-2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-1...v0.13.1-2) (2020-10-19) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.13.1-1"></a> -## [0.13.1-1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-3...v0.13.1-1) (2020-10-12) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.12.1-3"></a> -## [0.12.1-3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-2...v0.12.1-3) (2020-10-12) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.15"></a> -## [1.0.15](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.14...@ali/lowcode-types@1.0.15) (2020-11-05) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.14"></a> -## [1.0.14](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.13...@ali/lowcode-types@1.0.14) (2020-11-04) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.13"></a> -## [1.0.13](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.12...@ali/lowcode-types@1.0.13) (2020-11-04) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.13"></a> -## [1.0.13](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.12...@ali/lowcode-types@1.0.13) (2020-11-02) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.12"></a> -## [1.0.12](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.11...@ali/lowcode-types@1.0.12) (2020-10-20) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.11"></a> -## [1.0.11](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.10...@ali/lowcode-types@1.0.11) (2020-10-19) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.10"></a> -## [1.0.10](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.9...@ali/lowcode-types@1.0.10) (2020-09-29) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.9"></a> -## [1.0.9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.8...@ali/lowcode-types@1.0.9) (2020-09-28) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.8"></a> -## [1.0.8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.8-0...@ali/lowcode-types@1.0.8) (2020-09-28) - - -### Bug Fixes - -* 🐛 根据低代码规范,数据源的配置中isInit和 type 都是有默认值的,所以应该是可选的 ([4baf0b4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/4baf0b4)) -* 🐛 use lowcode types ([b11425b](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b11425b)) -* fix test result ([7f6fbe8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7f6fbe8)) -* miniAppBuildType config(temp) ([584b4c2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/584b4c2)) -* currentPage.id 返回 formUuid ([775725d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/775725d)) -* fix NextTable callback function ([ce77375](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ce77375)) -* panel visible time ([18ac1fa](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/18ac1fa)) -* supports ([371b84c](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/371b84c)) -* 低代码组件 props 显示 object 问题 ([116498e](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/116498e)) -* 修复 slot 获取初始值异常的 bug ([63b19f1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/63b19f1)) -* 修复判断动态 setter 的逻辑 ([d195d7f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/d195d7f)) -* 兼容事件绑定 ([f4c07af](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/f4c07af)) -* 可以降级到历史的 JSBlock 格式 ([af1746b](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/af1746b)) -* 合并master分支 ([bd2c6ad](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/bd2c6ad)) - - -### Features - -* 🎸 按照中后台搭建协议规范文档补充 JSFunction 的定义和数据源定义中一些字段 ([8b1d0c7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/8b1d0c7)) -* 🎸 补充规范中定义的 JSFunction 类型 ([9e32525](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/9e32525)) -* 🎸 根据低代码协议文档, 将 BlockSchema 也改成继承自 ContainerSchema ([7901c8e](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7901c8e)) -* 🎸 根据低代码协议文档, 完善UtilsMap的定义 ([7fe4bc0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7fe4bc0)) -* 🎸 urlParams 类型的数据源不需要 options, 所以 options 改成可选为好 ([8114c6f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/8114c6f)) -* 🎸 增加icon相关的判断函数 ([89064f5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/89064f5)) -* add filter reducer ([17c6ed3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/17c6ed3)) -* merge live mode ([92c3039](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/92c3039)) -* show value state ([bd49e50](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/bd49e50)) -* support plaintext liveediting ([ea62f12](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ea62f12)) -* support prop.autorun ([c0a5235](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/c0a5235)) -* 修复状态切换失效 ([2e3f60d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/2e3f60d)) -* 编辑器 hooks 能力实现 ([f3ac23b](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/f3ac23b)) - - - - -<a name="1.0.8-0"></a> -## [1.0.8-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.19...@ali/lowcode-types@1.0.8-0) (2020-09-09) - - -### Bug Fixes - -* 合并master分支 ([bd2c6ad](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/bd2c6ad)) -* fix NextTable callback function ([ce77375](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ce77375)) - - - - -<a name="0.8.19"></a> -## [0.8.19](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.18...@ali/lowcode-types@0.8.19) (2020-09-03) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.8.18"></a> -## [0.8.18](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.17...@ali/lowcode-types@0.8.18) (2020-09-03) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.8.17"></a> -## [0.8.17](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.16...@ali/lowcode-types@0.8.17) (2020-08-24) -<a name="1.0.7-0"></a> -## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.6-0...@ali/lowcode-types@1.0.7-0) (2020-09-02) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.6-0"></a> -## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.17...@ali/lowcode-types@1.0.6-0) (2020-09-02) - - -### Bug Fixes - -* 合并master分支 ([bd2c6ad](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/bd2c6ad)) -* fix NextTable callback function ([ce77375](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ce77375)) - - - - -<a name="1.0.5-0"></a> -## [1.0.5-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.4-0...@ali/lowcode-types@1.0.5-0) (2020-08-20) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.4-0"></a> -## [1.0.4-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.3-0...@ali/lowcode-types@1.0.4-0) (2020-08-20) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.3-0"></a> -## [1.0.3-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.2-0...@ali/lowcode-types@1.0.3-0) (2020-08-20) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.2-0"></a> -## [1.0.2-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@1.0.1-0...@ali/lowcode-types@1.0.2-0) (2020-08-20) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.1-0"></a> -## [1.0.1-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.16...@ali/lowcode-types@1.0.1-0) (2020-08-20) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="1.0.0"></a> -# [1.0.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.13.0...@ali/lowcode-types@1.0.0) (2020-08-17) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.13.0"></a> -# [0.13.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.12.0...@ali/lowcode-types@0.13.0) (2020-08-17) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.12.0"></a> -# [0.12.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.10.0...@ali/lowcode-types@0.12.0) (2020-08-17) -<a name="0.8.16"></a> -## [0.8.16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.15...@ali/lowcode-types@0.8.16) (2020-08-19) - - -### Bug Fixes - -* currentPage.id 返回 formUuid ([775725d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/775725d)) - - - - -<a name="0.8.15"></a> -## [0.8.15](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.14...@ali/lowcode-types@0.8.15) (2020-08-17) - - -### Bug Fixes - -* 修复判断动态 setter 的逻辑 ([d195d7f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/d195d7f)) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.11.0"></a> -# [0.11.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.10.0...@ali/lowcode-types@0.11.0) (2020-08-17) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.10.0"></a> -# [0.10.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.9.0...@ali/lowcode-types@0.10.0) (2020-08-16) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.9.0"></a> -# [0.9.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.14...@ali/lowcode-types@0.9.0) (2020-08-14) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.8.14"></a> -## [0.8.14](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.13...@ali/lowcode-types@0.8.14) (2020-08-04) - - -### Bug Fixes - -* 修复 slot 获取初始值异常的 bug ([63b19f1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/63b19f1)) - - - - -<a name="0.8.13"></a> -## [0.8.13](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.12...@ali/lowcode-types@0.8.13) (2020-07-21) - - -### Bug Fixes - -* 兼容事件绑定 ([f4c07af](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/f4c07af)) - - - - -<a name="0.8.12"></a> -## [0.8.12](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.11...@ali/lowcode-types@0.8.12) (2020-07-21) - - -### Bug Fixes - -* 可以降级到历史的 JSBlock 格式 ([af1746b](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/af1746b)) - - - - -<a name="0.8.11"></a> -## [0.8.11](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.10...@ali/lowcode-types@0.8.11) (2020-07-13) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.8.10"></a> -## [0.8.10](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.9...@ali/lowcode-types@0.8.10) (2020-07-12) - - -### Bug Fixes - -* 低代码组件 props 显示 object 问题 ([116498e](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/116498e)) - - - - -<a name="0.8.9"></a> -## [0.8.9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.7...@ali/lowcode-types@0.8.9) (2020-06-23) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.8.7"></a> -## [0.8.7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.6...@ali/lowcode-types@0.8.7) (2020-06-23) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.8.6"></a> -## [0.8.6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.5...@ali/lowcode-types@0.8.6) (2020-06-15) - - -### Features - -* support prop.autorun ([c0a5235](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/c0a5235)) - - - - -<a name="0.8.5"></a> -## [0.8.5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.4...@ali/lowcode-types@0.8.5) (2020-05-18) - - - - -**Note:** Version bump only for package @ali/lowcode-types - -<a name="0.8.4"></a> -## [0.8.4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.3...@ali/lowcode-types@0.8.4) (2020-05-15) - - -### Features - -* add filter reducer ([17c6ed3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/17c6ed3)) - - - - -<a name="0.8.3"></a> -## [0.8.3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.2...@ali/lowcode-types@0.8.3) (2020-05-13) - - -### Bug Fixes - -* panel visible time ([18ac1fa](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/18ac1fa)) -* supports ([371b84c](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/371b84c)) - - -### Features - -* show value state ([bd49e50](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/bd49e50)) -* support plaintext liveediting ([ea62f12](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ea62f12)) - - - - -<a name="0.8.2"></a> -## [0.8.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-types@0.8.1...@ali/lowcode-types@0.8.2) (2020-05-07) - - -### Features - -* 🎸 增加icon相关的判断函数 ([89064f5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/89064f5)) -* 修复状态切换失效 ([2e3f60d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/2e3f60d)) - - - - -<a name="0.8.1"></a> -## 0.8.1 (2020-04-27) - - - - -**Note:** Version bump only for package @ali/lowcode-types diff --git a/packages/types/package.json b/packages/types/package.json index 5651d427d4..1a6f8f7430 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { - "name": "@alilc/lowcode-types", - "version": "1.3.2", + "name": "@felce/lowcode-types", + "version": "1.4.0", "description": "Types for Ali lowCode engine", "files": [ "es", @@ -12,6 +12,7 @@ "build": "build-scripts build" }, "dependencies": { + "@alifd/next": "^1.26.0", "@alilc/lowcode-datasource-types": "^1.0.0", "react": "^16.9", "strict-event-emitter-types": "^2.0.0" @@ -27,9 +28,9 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/types" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/packages/types" }, "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/packages/types/src/deprecated/isActionContentObject.ts b/packages/types/src/deprecated/isActionContentObject.ts index 88a8e57d2e..9c646c3bbd 100644 --- a/packages/types/src/deprecated/isActionContentObject.ts +++ b/packages/types/src/deprecated/isActionContentObject.ts @@ -1,8 +1,10 @@ import { IPublicTypeActionContentObject } from '../shell'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ -export function isActionContentObject(obj: any): obj is IPublicTypeActionContentObject { +export function isActionContentObject( + obj: any, +): obj is IPublicTypeActionContentObject { return obj && typeof obj === 'object'; } diff --git a/packages/types/src/deprecated/isCustomView.ts b/packages/types/src/deprecated/isCustomView.ts index 159490e550..c58d33f2d0 100644 --- a/packages/types/src/deprecated/isCustomView.ts +++ b/packages/types/src/deprecated/isCustomView.ts @@ -3,7 +3,7 @@ import { isReactComponent } from './isReactComponent'; import { IPublicTypeCustomView } from '../shell/type/custom-view'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isCustomView(obj: any): obj is IPublicTypeCustomView { return obj && (isValidElement(obj) || isReactComponent(obj)); diff --git a/packages/types/src/deprecated/isDOMText.ts b/packages/types/src/deprecated/isDOMText.ts index 4ddc91320f..52e4c2f051 100644 --- a/packages/types/src/deprecated/isDOMText.ts +++ b/packages/types/src/deprecated/isDOMText.ts @@ -1,7 +1,7 @@ import { IPublicTypeDOMText } from '../shell/type/dom-text'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isDOMText(data: any): data is IPublicTypeDOMText { return typeof data === 'string'; diff --git a/packages/types/src/deprecated/isDynamicSetter.ts b/packages/types/src/deprecated/isDynamicSetter.ts index 55532d258d..80a7b001b6 100644 --- a/packages/types/src/deprecated/isDynamicSetter.ts +++ b/packages/types/src/deprecated/isDynamicSetter.ts @@ -2,7 +2,7 @@ import { isReactClass } from './isReactClass'; import { IPublicTypeDynamicSetter } from '../shell/type/dynamic-setter'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isDynamicSetter(obj: any): obj is IPublicTypeDynamicSetter { return obj && typeof obj === 'function' && !isReactClass(obj); diff --git a/packages/types/src/deprecated/isI18nData.ts b/packages/types/src/deprecated/isI18nData.ts index 4767ccd373..99337af7c6 100644 --- a/packages/types/src/deprecated/isI18nData.ts +++ b/packages/types/src/deprecated/isI18nData.ts @@ -1,6 +1,5 @@ - /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isI18nData(obj: any): boolean { return obj && obj.type === 'i18n'; diff --git a/packages/types/src/deprecated/isJSBlock.ts b/packages/types/src/deprecated/isJSBlock.ts index 6f92e2fcf1..887ad1c4b0 100644 --- a/packages/types/src/deprecated/isJSBlock.ts +++ b/packages/types/src/deprecated/isJSBlock.ts @@ -1,7 +1,7 @@ import { IPublicTypeJSBlock } from '../shell/type/value-type'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isJSBlock(data: any): data is IPublicTypeJSBlock { return data && data.type === 'JSBlock'; diff --git a/packages/types/src/deprecated/isJSExpression.ts b/packages/types/src/deprecated/isJSExpression.ts index f722d55293..0b648bb49d 100644 --- a/packages/types/src/deprecated/isJSExpression.ts +++ b/packages/types/src/deprecated/isJSExpression.ts @@ -1,7 +1,7 @@ import { IPublicTypeJSExpression } from '../shell/type/value-type'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isJSExpression(data: any): data is IPublicTypeJSExpression { return data && data.type === 'JSExpression' && data.extType !== 'function'; diff --git a/packages/types/src/deprecated/isJSFunction.ts b/packages/types/src/deprecated/isJSFunction.ts index 40ab4f52dc..1519ba4336 100644 --- a/packages/types/src/deprecated/isJSFunction.ts +++ b/packages/types/src/deprecated/isJSFunction.ts @@ -1,7 +1,7 @@ import { IPublicTypeJSFunction } from '../shell/type/value-type'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isJSFunction(x: any): x is IPublicTypeJSFunction { return typeof x === 'object' && x && x.type === 'JSFunction'; diff --git a/packages/types/src/deprecated/isJSSlot.ts b/packages/types/src/deprecated/isJSSlot.ts index 7cba651958..e4b7efd457 100644 --- a/packages/types/src/deprecated/isJSSlot.ts +++ b/packages/types/src/deprecated/isJSSlot.ts @@ -1,7 +1,7 @@ import { IPublicTypeJSSlot } from '../shell/type/value-type'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isJSSlot(data: any): data is IPublicTypeJSSlot { return data && data.type === 'JSSlot'; diff --git a/packages/types/src/deprecated/isLowCodeComponentType.ts b/packages/types/src/deprecated/isLowCodeComponentType.ts index c14c85f1eb..a8e34b92bd 100644 --- a/packages/types/src/deprecated/isLowCodeComponentType.ts +++ b/packages/types/src/deprecated/isLowCodeComponentType.ts @@ -1,9 +1,14 @@ import { isProCodeComponentType } from './isProCodeComponentType'; -import { IPublicTypeComponentMap, IPublicTypeLowCodeComponent } from '../shell/type/npm'; +import { + IPublicTypeComponentMap, + IPublicTypeLowCodeComponent, +} from '../shell/type/npm'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ -export function isLowCodeComponentType(desc: IPublicTypeComponentMap): desc is IPublicTypeLowCodeComponent { +export function isLowCodeComponentType( + desc: IPublicTypeComponentMap, +): desc is IPublicTypeLowCodeComponent { return !isProCodeComponentType(desc); } diff --git a/packages/types/src/deprecated/isNodeSchema.ts b/packages/types/src/deprecated/isNodeSchema.ts index cab4dc46e1..8dc1f74599 100644 --- a/packages/types/src/deprecated/isNodeSchema.ts +++ b/packages/types/src/deprecated/isNodeSchema.ts @@ -1,7 +1,7 @@ import { IPublicTypeNodeSchema } from '../shell'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isNodeSchema(data: any): data is IPublicTypeNodeSchema { return data && data.componentName; diff --git a/packages/types/src/deprecated/isPlainObject.ts b/packages/types/src/deprecated/isPlainObject.ts index 549f497360..a8566bcb0c 100644 --- a/packages/types/src/deprecated/isPlainObject.ts +++ b/packages/types/src/deprecated/isPlainObject.ts @@ -1,10 +1,14 @@ /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isPlainObject(value: any): value is Record<string, unknown> { if (typeof value !== 'object') { return false; } const proto = Object.getPrototypeOf(value); - return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null; + return ( + proto === Object.prototype || + proto === null || + Object.getPrototypeOf(proto) === null + ); } diff --git a/packages/types/src/deprecated/isProCodeComponentType.ts b/packages/types/src/deprecated/isProCodeComponentType.ts index 40e8e977f9..c2d05e2fca 100644 --- a/packages/types/src/deprecated/isProCodeComponentType.ts +++ b/packages/types/src/deprecated/isProCodeComponentType.ts @@ -1,8 +1,13 @@ -import { IPublicTypeComponentMap, IPublicTypeProCodeComponent } from '../shell/type/npm'; +import { + IPublicTypeComponentMap, + IPublicTypeProCodeComponent, +} from '../shell/type/npm'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ -export function isProCodeComponentType(desc: IPublicTypeComponentMap): desc is IPublicTypeProCodeComponent { +export function isProCodeComponentType( + desc: IPublicTypeComponentMap, +): desc is IPublicTypeProCodeComponent { return 'package' in desc; } diff --git a/packages/types/src/deprecated/isProjectSchema.ts b/packages/types/src/deprecated/isProjectSchema.ts index 1622fa8466..08e6ea375d 100644 --- a/packages/types/src/deprecated/isProjectSchema.ts +++ b/packages/types/src/deprecated/isProjectSchema.ts @@ -1,5 +1,5 @@ /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isProjectSchema(data: any): boolean { return data && data.componentsTree; diff --git a/packages/types/src/deprecated/isReactClass.ts b/packages/types/src/deprecated/isReactClass.ts index 846c522d7b..7246c3a680 100644 --- a/packages/types/src/deprecated/isReactClass.ts +++ b/packages/types/src/deprecated/isReactClass.ts @@ -1,8 +1,12 @@ import { ComponentClass, Component } from 'react'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isReactClass(obj: any): obj is ComponentClass<any> { - return obj && obj.prototype && (obj.prototype.isReactComponent || obj.prototype instanceof Component); + return ( + obj && + obj.prototype && + (obj.prototype.isReactComponent || obj.prototype instanceof Component) + ); } diff --git a/packages/types/src/deprecated/isReactComponent.ts b/packages/types/src/deprecated/isReactComponent.ts index 1ed04427f3..a35b785b3b 100644 --- a/packages/types/src/deprecated/isReactComponent.ts +++ b/packages/types/src/deprecated/isReactComponent.ts @@ -2,7 +2,7 @@ import { ComponentType } from 'react'; import { isReactClass } from './isReactClass'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isReactComponent(obj: any): obj is ComponentType<any> { return obj && (isReactClass(obj) || typeof obj === 'function'); diff --git a/packages/types/src/deprecated/isSetterConfig.ts b/packages/types/src/deprecated/isSetterConfig.ts index bf0d77e115..85a6f23152 100644 --- a/packages/types/src/deprecated/isSetterConfig.ts +++ b/packages/types/src/deprecated/isSetterConfig.ts @@ -2,8 +2,13 @@ import { IPublicTypeSetterConfig } from '../shell/type/setter-config'; import { isCustomView } from './isCustomView'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isSetterConfig(obj: any): obj is IPublicTypeSetterConfig { - return obj && typeof obj === 'object' && 'componentName' in obj && !isCustomView(obj); + return ( + obj && + typeof obj === 'object' && + 'componentName' in obj && + !isCustomView(obj) + ); } diff --git a/packages/types/src/deprecated/isTitleConfig.ts b/packages/types/src/deprecated/isTitleConfig.ts index 9ee38c9c25..f4826161de 100644 --- a/packages/types/src/deprecated/isTitleConfig.ts +++ b/packages/types/src/deprecated/isTitleConfig.ts @@ -3,7 +3,7 @@ import { isPlainObject } from './isPlainObject'; import { IPublicTypeTitleConfig } from '../shell/type/title-config'; /** - * @deprecated use same function from '@alilc/lowcode-utils' instead + * @deprecated use same function from '@felce/lowcode-utils' instead */ export function isTitleConfig(obj: any): obj is IPublicTypeTitleConfig { return isPlainObject(obj) && !isI18nData(obj); diff --git a/packages/types/src/shell/api/material.ts b/packages/types/src/shell/api/material.ts index 89b2b39ad1..922c4a1199 100644 --- a/packages/types/src/shell/api/material.ts +++ b/packages/types/src/shell/api/material.ts @@ -1,14 +1,23 @@ -import { IPublicTypeAssetsJson, IPublicTypeMetadataTransducer, IPublicTypeComponentAction, IPublicTypeNpmInfo, IPublicTypeDisposable, IPublicTypeContextMenuAction, IPublicTypeContextMenuItem } from '../type'; +import { + IPublicTypeAssetsJson, + IPublicTypeMetadataTransducer, + IPublicTypeComponentAction, + IPublicTypeNpmInfo, + IPublicTypeDisposable, + IPublicTypeContextMenuAction, + IPublicTypeContextMenuItem, +} from '../type'; import { IPublicModelComponentMeta } from '../model'; import { ComponentType } from 'react'; export interface IPublicApiMaterial { - /** * 获取组件 map 结构 * get map of components */ - get componentsMap(): { [key: string]: IPublicTypeNpmInfo | ComponentType<any> | object } ; + get componentsMap(): { + [key: string]: IPublicTypeNpmInfo | ComponentType<any> | object; + }; /** * 设置「资产包」结构 @@ -43,7 +52,7 @@ export interface IPublicApiMaterial { registerMetadataTransducer( transducer: IPublicTypeMetadataTransducer, level?: number, - id?: string | undefined + id?: string | undefined, ): void; /** @@ -81,8 +90,8 @@ export interface IPublicApiMaterial { * @param action * @example * ```ts - * import { plugins } from '@alilc/lowcode-engine'; - * import { IPublicModelPluginContext } from '@alilc/lowcode-types'; + * import { plugins } from '@felce/lowcode-engine'; + * import { IPublicModelPluginContext } from '@felce/lowcode-types'; * * const removeCopyAction = (ctx: IPublicModelPluginContext) => { * return { @@ -112,9 +121,9 @@ export interface IPublicApiMaterial { * @param handle */ modifyBuiltinComponentAction( - actionName: string, - handle: (action: IPublicTypeComponentAction) => void, - ): void; + actionName: string, + handle: (action: IPublicTypeComponentAction) => void, + ): void; /** * 监听 assets 变化的事件 @@ -145,5 +154,7 @@ export interface IPublicApiMaterial { * 调整右键菜单项布局 * @param actions */ - adjustContextMenuLayout(fn: (actions: IPublicTypeContextMenuItem[]) => IPublicTypeContextMenuItem[]): void; + adjustContextMenuLayout( + fn: (actions: IPublicTypeContextMenuItem[]) => IPublicTypeContextMenuItem[], + ): void; } diff --git a/packages/types/src/shell/api/project.ts b/packages/types/src/shell/api/project.ts index 662f302ccc..f01d15f601 100644 --- a/packages/types/src/shell/api/project.ts +++ b/packages/types/src/shell/api/project.ts @@ -1,12 +1,15 @@ -import { IPublicTypeProjectSchema, IPublicTypeDisposable, IPublicTypeRootSchema, IPublicTypePropsTransducer, IPublicTypeAppConfig } from '../type'; +import { + IPublicTypeProjectSchema, + IPublicTypeDisposable, + IPublicTypeRootSchema, + IPublicTypePropsTransducer, + IPublicTypeAppConfig, +} from '../type'; import { IPublicEnumTransformStage } from '../enum'; import { IPublicApiSimulatorHost } from './'; import { IPublicModelDocumentModel } from '../model'; -export interface IBaseApiProject< - DocumentModel -> { - +export interface IBaseApiProject<DocumentModel> { /** * 获取当前的 document * get current document @@ -32,7 +35,9 @@ export interface IBaseApiProject< * @param doc * @returns */ - openDocument(doc?: string | IPublicTypeRootSchema | undefined): DocumentModel | null; + openDocument( + doc?: string | IPublicTypeRootSchema | undefined, + ): DocumentModel | null; /** * 创建一个 document @@ -93,9 +98,9 @@ export interface IBaseApiProject< * @param stage */ addPropsTransducer( - transducer: IPublicTypePropsTransducer, - stage: IPublicEnumTransformStage, - ): void; + transducer: IPublicTypePropsTransducer, + stage: IPublicEnumTransformStage, + ): void; /** * 绑定删除文档事件 @@ -115,7 +120,9 @@ export interface IBaseApiProject< * 当前 project 的模拟器 ready 事件 * set callback for event onSimulatorHostReady */ - onSimulatorHostReady(fn: (host: IPublicApiSimulatorHost) => void): IPublicTypeDisposable; + onSimulatorHostReady( + fn: (host: IPublicApiSimulatorHost) => void, + ): IPublicTypeDisposable; /** * 当前 project 的渲染器 ready 事件 @@ -125,7 +132,7 @@ export interface IBaseApiProject< /** * 设置多语言语料 - * 数据格式参考 https://github.com/alibaba/lowcode-engine/blob/main/specs/lowcode-spec.md#2434%E5%9B%BD%E9%99%85%E5%8C%96%E5%A4%9A%E8%AF%AD%E8%A8%80%E7%B1%BB%E5%9E%8Baa + * 数据格式参考 https://github.com/fe-lce/lowcode-engine/blob/main/specs/lowcode-spec.md#2434%E5%9B%BD%E9%99%85%E5%8C%96%E5%A4%9A%E8%AF%AD%E8%A8%80%E7%B1%BB%E5%9E%8Baa * * set I18n data for this project * @param value object @@ -140,8 +147,12 @@ export interface IBaseApiProject< * @param value object * @since v1.1.4 */ - setConfig<T extends keyof IPublicTypeAppConfig>(key: T, value: IPublicTypeAppConfig[T]): void; + setConfig<T extends keyof IPublicTypeAppConfig>( + key: T, + value: IPublicTypeAppConfig[T], + ): void; setConfig(value: IPublicTypeAppConfig): void; } -export interface IPublicApiProject extends IBaseApiProject<IPublicModelDocumentModel> {} +export interface IPublicApiProject + extends IBaseApiProject<IPublicModelDocumentModel> {} diff --git a/packages/types/src/shell/api/workspace.ts b/packages/types/src/shell/api/workspace.ts index b6e7d84cb7..0144ca9cce 100644 --- a/packages/types/src/shell/api/workspace.ts +++ b/packages/types/src/shell/api/workspace.ts @@ -1,5 +1,12 @@ import { IPublicModelWindow } from '../model'; -import { IPublicApiPlugins, IPublicApiSkeleton, IPublicModelResource, IPublicResourceList, IPublicTypeDisposable, IPublicTypeResourceType } from '@alilc/lowcode-types'; +import { + IPublicApiPlugins, + IPublicApiSkeleton, + IPublicModelResource, + IPublicResourceList, + IPublicTypeDisposable, + IPublicTypeResourceType, +} from '@felce/lowcode-types'; export interface IPublicApiWorkspace< Plugins = IPublicApiPlugins, @@ -7,7 +14,6 @@ export interface IPublicApiWorkspace< ModelWindow = IPublicModelWindow, Resource = IPublicModelResource, > { - /** 是否启用 workspace 模式 */ isActive: boolean; @@ -28,7 +34,9 @@ export interface IPublicApiWorkspace< setResourceList(resourceList: IPublicResourceList): void; /** 资源树列表更新事件 */ - onResourceListChange(fn: (resourceList: IPublicResourceList) => void): IPublicTypeDisposable; + onResourceListChange( + fn: (resourceList: IPublicResourceList) => void, + ): IPublicTypeDisposable; /** 注册资源 */ registerResourceType(resourceTypeModel: IPublicTypeResourceType): void; @@ -37,7 +45,13 @@ export interface IPublicApiWorkspace< * 打开视图窗口 * @deprecated */ - openEditorWindow(resourceName: string, id: string, extra: Object, viewName?: string, sleep?: boolean): Promise<void>; + openEditorWindow( + resourceName: string, + id: string, + extra: Object, + viewName?: string, + sleep?: boolean, + ): Promise<void>; /** 打开视图窗口 */ openEditorWindow(resource: Resource, sleep?: boolean): Promise<void>; @@ -76,4 +90,4 @@ export interface IPublicApiWorkspace< * @since v1.1.7 */ onWindowRendererReady(fn: () => void): IPublicTypeDisposable; -} \ No newline at end of file +} diff --git a/packages/types/src/shell/model/document-model.ts b/packages/types/src/shell/model/document-model.ts index 4c9344eb48..e2aa2ac464 100644 --- a/packages/types/src/shell/model/document-model.ts +++ b/packages/types/src/shell/model/document-model.ts @@ -1,8 +1,25 @@ -import { IPublicTypeRootSchema, IPublicTypeDragNodeDataObject, IPublicTypeDragNodeObject, IPublicTypePropChangeOptions, IPublicTypeDisposable } from '../type'; +import { + IPublicTypeRootSchema, + IPublicTypeDragNodeDataObject, + IPublicTypeDragNodeObject, + IPublicTypePropChangeOptions, + IPublicTypeDisposable, +} from '../type'; import { IPublicEnumTransformStage } from '../enum'; import { IPublicApiProject } from '../api'; -import { IPublicModelDropLocation, IPublicModelDetecting, IPublicModelNode, IPublicModelSelection, IPublicModelHistory, IPublicModelModalNodesManager } from './'; -import { IPublicTypeNodeData, IPublicTypeNodeSchema, IPublicTypeOnChangeOptions } from '@alilc/lowcode-types'; +import { + IPublicModelDropLocation, + IPublicModelDetecting, + IPublicModelNode, + IPublicModelSelection, + IPublicModelHistory, + IPublicModelModalNodesManager, +} from './'; +import { + IPublicTypeNodeData, + IPublicTypeNodeSchema, + IPublicTypeOnChangeOptions, +} from '@felce/lowcode-types'; export interface IPublicModelDocumentModel< Selection = IPublicModelSelection, @@ -10,13 +27,12 @@ export interface IPublicModelDocumentModel< Node = IPublicModelNode, DropLocation = IPublicModelDropLocation, ModalNodesManager = IPublicModelModalNodesManager, - Project = IPublicApiProject + Project = IPublicApiProject, > { - /** - * 节点选中区模型实例 - * instance of selection - */ + * 节点选中区模型实例 + * instance of selection + */ selection: Selection; /** @@ -89,7 +105,9 @@ export interface IPublicModelDocumentModel< * @param stage * @returns */ - exportSchema(stage: IPublicEnumTransformStage): IPublicTypeRootSchema | undefined; + exportSchema( + stage: IPublicEnumTransformStage, + ): IPublicTypeRootSchema | undefined; /** * 插入节点 @@ -99,7 +117,7 @@ export interface IPublicModelDocumentModel< parent: Node, thing: Node | IPublicTypeNodeData, at?: number | null | undefined, - copy?: boolean | undefined + copy?: boolean | undefined, ): Node | null; /** @@ -134,7 +152,7 @@ export interface IPublicModelDocumentModel< */ checkNesting( dropTarget: Node, - dragObject: IPublicTypeDragNodeObject | IPublicTypeDragNodeDataObject + dragObject: IPublicTypeDragNodeObject | IPublicTypeDragNodeDataObject, ): boolean; /** @@ -173,26 +191,34 @@ export interface IPublicModelDocumentModel< * set callback for event on visibility changed for certain node * @param fn */ - onChangeNodeVisible(fn: (node: Node, visible: boolean) => void): IPublicTypeDisposable; + onChangeNodeVisible( + fn: (node: Node, visible: boolean) => void, + ): IPublicTypeDisposable; /** * 当前 document 的节点 children 变更事件 * @param fn */ - onChangeNodeChildren(fn: (info: IPublicTypeOnChangeOptions<Node>) => void): IPublicTypeDisposable; + onChangeNodeChildren( + fn: (info: IPublicTypeOnChangeOptions<Node>) => void, + ): IPublicTypeDisposable; /** * 当前 document 节点属性修改事件 * @param fn */ - onChangeNodeProp(fn: (info: IPublicTypePropChangeOptions<Node>) => void): IPublicTypeDisposable; + onChangeNodeProp( + fn: (info: IPublicTypePropChangeOptions<Node>) => void, + ): IPublicTypeDisposable; /** * import schema event * @param fn * @since v1.0.15 */ - onImportSchema(fn: (schema: IPublicTypeRootSchema) => void): IPublicTypeDisposable; + onImportSchema( + fn: (schema: IPublicTypeRootSchema) => void, + ): IPublicTypeDisposable; /** * 判断是否当前节点处于被探测状态 @@ -232,5 +258,7 @@ export interface IPublicModelDocumentModel< * @param fn * @since v1.1.0 */ - onDropLocationChanged(fn: (doc: IPublicModelDocumentModel) => void): IPublicTypeDisposable; + onDropLocationChanged( + fn: (doc: IPublicModelDocumentModel) => void, + ): IPublicTypeDisposable; } diff --git a/packages/utils/jest.config.js b/packages/utils/jest.config.js index 0631fa00c9..969a79758a 100644 --- a/packages/utils/jest.config.js +++ b/packages/utils/jest.config.js @@ -1,21 +1,16 @@ const fs = require('fs'); const { join } = require('path'); -const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.')); +const pkgNames = fs.readdirSync(join('..')).filter((pkgName) => !pkgName.startsWith('.')); const jestConfig = { moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], collectCoverage: false, - collectCoverageFrom: [ - 'src/**/*.ts', - '!src/**/*.d.ts', - '!**/node_modules/**', - '!**/vendor/**', - ], + collectCoverageFrom: ['src/**/*.ts', '!src/**/*.d.ts', '!**/node_modules/**', '!**/vendor/**'], setupFilesAfterEnv: ['./jest.setup.js'], }; // 只对本仓库内的 pkg 做 mapping jestConfig.moduleNameMapper = {}; -jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; +jestConfig.moduleNameMapper[`^@felce/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src'; -module.exports = jestConfig; \ No newline at end of file +module.exports = jestConfig; diff --git a/packages/utils/package.json b/packages/utils/package.json index 60605d81e7..abf50b017c 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { - "name": "@alilc/lowcode-utils", - "version": "1.3.2", + "name": "@felce/lowcode-utils", + "version": "1.4.0", "description": "Utils for Ali lowCode engine", "files": [ "lib", @@ -13,8 +13,9 @@ "build": "build-scripts build" }, "dependencies": { - "@alifd/next": "^1.19.16", - "@alilc/lowcode-types": "1.3.2", + "@alifd/next": "^1.26.0", + "@felce/lowcode-types": "1.4.0", + "events": "^3.3.0", "lodash": "^4.17.21", "mobx": "^6.3.0", "prop-types": "^15.8.1", @@ -34,9 +35,9 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/utils" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/packages/utils" }, "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/packages/utils/src/asset.ts b/packages/utils/src/asset.ts index 3400f965b4..0126793660 100644 --- a/packages/utils/src/asset.ts +++ b/packages/utils/src/asset.ts @@ -1,12 +1,24 @@ -import { AssetType, AssetLevels, AssetLevel } from '@alilc/lowcode-types'; -import type { AssetItem, Asset, AssetList, AssetBundle, IPublicTypeAssetsJson } from '@alilc/lowcode-types'; +import { AssetType, AssetLevels, AssetLevel } from '@felce/lowcode-types'; +import type { + AssetItem, + Asset, + AssetList, + AssetBundle, + IPublicTypeAssetsJson, +} from '@felce/lowcode-types'; import { isCSSUrl } from './is-css-url'; import { createDefer } from './create-defer'; import { load, evaluate } from './script'; // API 向下兼容 -export { AssetType, AssetLevels, AssetLevel } from '@alilc/lowcode-types'; -export type { AssetItem, Asset, AssetList, AssetBundle, IPublicTypeAssetsJson } from '@alilc/lowcode-types'; +export { AssetType, AssetLevels, AssetLevel } from '@felce/lowcode-types'; +export type { + AssetItem, + Asset, + AssetList, + AssetBundle, + IPublicTypeAssetsJson, +} from '@felce/lowcode-types'; export function isAssetItem(obj: any): obj is AssetItem { return obj && obj.type; @@ -17,9 +29,9 @@ export function isAssetBundle(obj: any): obj is AssetBundle { } export function assetBundle( - assets?: Asset | AssetList | null, - level?: AssetLevel, - ): AssetBundle | null { + assets?: Asset | AssetList | null, + level?: AssetLevel, +): AssetBundle | null { if (!assets) { return null; } @@ -38,7 +50,12 @@ urls: [ "view1.js mobile|pc", "view2.js <device selector>" ] */ -export function assetItem(type: AssetType, content?: string | null, level?: AssetLevel, id?: string): AssetItem | null { +export function assetItem( + type: AssetType, + content?: string | null, + level?: AssetLevel, + id?: string, +): AssetItem | null { if (!content) { return null; } @@ -50,7 +67,10 @@ export function assetItem(type: AssetType, content?: string | null, level?: Asse }; } -export function mergeAssets(assets: IPublicTypeAssetsJson, incrementalAssets: IPublicTypeAssetsJson): IPublicTypeAssetsJson { +export function mergeAssets( + assets: IPublicTypeAssetsJson, + incrementalAssets: IPublicTypeAssetsJson, +): IPublicTypeAssetsJson { if (incrementalAssets.packages) { assets.packages = [...(assets.packages || []), ...incrementalAssets.packages]; } @@ -65,7 +85,11 @@ export function mergeAssets(assets: IPublicTypeAssetsJson, incrementalAssets: IP return assets; } -function mergeAssetsComponentList(assets: IPublicTypeAssetsJson, incrementalAssets: IPublicTypeAssetsJson, listName: keyof IPublicTypeAssetsJson): void { +function mergeAssetsComponentList( + assets: IPublicTypeAssetsJson, + incrementalAssets: IPublicTypeAssetsJson, + listName: keyof IPublicTypeAssetsJson, +): void { if (incrementalAssets[listName]) { if (assets[listName]) { // 根据title进行合并 @@ -131,7 +155,10 @@ export class StylePoint { element.setAttribute('data-id', this.id); } element.appendChild(document.createTextNode(content)); - document.head.insertBefore(element, this.placeholder.parentNode === document.head ? this.placeholder.nextSibling : null); + document.head.insertBefore( + element, + this.placeholder.parentNode === document.head ? this.placeholder.nextSibling : null, + ); document.head.removeChild(this.placeholder); this.placeholder = element; } @@ -162,7 +189,10 @@ export class StylePoint { if (this.id) { element.setAttribute('data-id', this.id); } - document.head.insertBefore(element, this.placeholder.parentNode === document.head ? this.placeholder.nextSibling : null); + document.head.insertBefore( + element, + this.placeholder.parentNode === document.head ? this.placeholder.nextSibling : null, + ); document.head.removeChild(this.placeholder); this.placeholder = element; return i.promise(); @@ -175,7 +205,12 @@ function parseAssetList(scripts: any, styles: any, assets: AssetList, level?: As } } -function parseAsset(scripts: any, styles: any, asset: Asset | undefined | null, level?: AssetLevel) { +function parseAsset( + scripts: any, + styles: any, + asset: Asset | undefined | null, + level?: AssetLevel, +) { if (!asset) { return; } @@ -219,7 +254,7 @@ export class AssetLoader { async load(asset: Asset) { const styles: any = {}; const scripts: any = {}; - AssetLevels.forEach(lv => { + AssetLevels.forEach((lv) => { styles[lv] = []; scripts[lv] = []; }); @@ -237,12 +272,23 @@ export class AssetLoader { scripts[AssetLevel.App], ); await Promise.all( - styleQueue.map(({ content, level, type, id }) => this.loadStyle(content, level!, type === AssetType.CSSUrl, id)), + styleQueue.map(({ content, level, type, id }) => + this.loadStyle(content, level!, type === AssetType.CSSUrl, id), + ), + ); + await Promise.all( + scriptQueue.map(({ content, type, scriptType }) => + this.loadScript(content, type === AssetType.JSUrl, scriptType), + ), ); - await Promise.all(scriptQueue.map(({ content, type, scriptType }) => this.loadScript(content, type === AssetType.JSUrl, scriptType))); } - private loadStyle(content: string | undefined | null, level: AssetLevel, isUrl?: boolean, id?: string) { + private loadStyle( + content: string | undefined | null, + level: AssetLevel, + isUrl?: boolean, + id?: string, + ) { if (!content) { return; } diff --git a/packages/utils/src/build-components.ts b/packages/utils/src/build-components.ts index 909248524f..d3ddc5e888 100644 --- a/packages/utils/src/build-components.ts +++ b/packages/utils/src/build-components.ts @@ -1,5 +1,9 @@ import { ComponentType, forwardRef, createElement, FunctionComponent } from 'react'; -import { IPublicTypeNpmInfo, IPublicTypeComponentSchema, IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import { + IPublicTypeNpmInfo, + IPublicTypeComponentSchema, + IPublicTypeProjectSchema, +} from '@felce/lowcode-types'; import { isESModule } from './is-es-module'; import { isReactComponent, acceptsRef, wrapReactClass } from './is-react'; import { isObject } from './is-object'; @@ -92,12 +96,20 @@ function isMixinComponent(components: any) { return false; } - return Object.keys(components).some(componentName => isReactComponent(components[componentName])); + return Object.keys(components).some((componentName) => + isReactComponent(components[componentName]), + ); } -export function buildComponents(libraryMap: LibraryMap, - componentsMap: { [componentName: string]: IPublicTypeNpmInfo | ComponentType<any> | IPublicTypeComponentSchema }, - createComponent: (schema: IPublicTypeProjectSchema<IPublicTypeComponentSchema>) => Component | null) { +export function buildComponents( + libraryMap: LibraryMap, + componentsMap: { + [componentName: string]: IPublicTypeNpmInfo | ComponentType<any> | IPublicTypeComponentSchema; + }, + createComponent: ( + schema: IPublicTypeProjectSchema<IPublicTypeComponentSchema>, + ) => Component | null, +) { const components: any = {}; Object.keys(componentsMap).forEach((componentName) => { let component = componentsMap[componentName]; @@ -150,14 +162,17 @@ interface LibrayMap { interface ProjectUtils { [packageName: string]: any; } -export function getProjectUtils(librayMap: LibrayMap, utilsMetadata: UtilsMetadata[]): ProjectUtils { +export function getProjectUtils( + librayMap: LibrayMap, + utilsMetadata: UtilsMetadata[], +): ProjectUtils { const projectUtils: ProjectUtils = {}; if (utilsMetadata) { - utilsMetadata.forEach(meta => { + utilsMetadata.forEach((meta) => { if (librayMap[meta?.npm?.package]) { const lib = accessLibrary(librayMap[meta?.npm.package]); if (lib?.destructuring) { - Object.keys(lib).forEach(name => { + Object.keys(lib).forEach((name) => { if (name === 'destructuring') return; projectUtils[name] = lib[name]; }); @@ -168,4 +183,4 @@ export function getProjectUtils(librayMap: LibrayMap, utilsMetadata: UtilsMetada }); } return projectUtils; -} \ No newline at end of file +} diff --git a/packages/utils/src/check-prop-types.ts b/packages/utils/src/check-prop-types.ts index dc9ce31ed5..e4fedefdca 100644 --- a/packages/utils/src/check-prop-types.ts +++ b/packages/utils/src/check-prop-types.ts @@ -1,7 +1,7 @@ import * as ReactIs from 'react-is'; import { default as ReactPropTypesSecret } from 'prop-types/lib/ReactPropTypesSecret'; import { default as factoryWithTypeCheckers } from 'prop-types/factoryWithTypeCheckers'; -import { IPublicTypePropType } from '@alilc/lowcode-types'; +import { IPublicTypePropType } from '@felce/lowcode-types'; import { isRequiredPropType } from './check-types/is-required-prop-type'; import { Logger } from './logger'; @@ -27,13 +27,17 @@ export function transformPropTypesRuleToString(rule: IPublicTypePropType | strin case 'oneOf': return `PropTypes.oneOf([${value.map((item: any) => `"${item}"`).join(',')}])`; case 'oneOfType': - return `PropTypes.oneOfType([${value.map((item: any) => transformPropTypesRuleToString(item)).join(', ')}])`; + return `PropTypes.oneOfType([${value + .map((item: any) => transformPropTypesRuleToString(item)) + .join(', ')}])`; case 'arrayOf': case 'objectOf': return `PropTypes.${type}(${transformPropTypesRuleToString(value)})`; case 'shape': case 'exact': - return `PropTypes.${type}({${value.map((item: any) => `${item.name}: ${transformPropTypesRuleToString(item.propType)}`).join(',')}})`; + return `PropTypes.${type}({${value + .map((item: any) => `${item.name}: ${transformPropTypesRuleToString(item.propType)}`) + .join(',')}})`; default: logger.error(`Unknown prop type: ${type}`); } @@ -41,15 +45,28 @@ export function transformPropTypesRuleToString(rule: IPublicTypePropType | strin return 'PropTypes.any'; } -export function checkPropTypes(value: any, name: string, rule: any, componentName: string): boolean { +export function checkPropTypes( + value: any, + name: string, + rule: any, + componentName: string, +): boolean { let ruleFunction = rule; if (typeof rule === 'object') { // eslint-disable-next-line no-new-func - ruleFunction = new Function(`"use strict"; const PropTypes = arguments[0]; return ${transformPropTypesRuleToString(rule)}`)(PropTypes2); + ruleFunction = new Function( + `"use strict"; const PropTypes = arguments[0]; return ${transformPropTypesRuleToString( + rule, + )}`, + )(PropTypes2); } if (typeof rule === 'string') { // eslint-disable-next-line no-new-func - ruleFunction = new Function(`"use strict"; const PropTypes = arguments[0]; return ${transformPropTypesRuleToString(rule)}`)(PropTypes2); + ruleFunction = new Function( + `"use strict"; const PropTypes = arguments[0]; return ${transformPropTypesRuleToString( + rule, + )}`, + )(PropTypes2); } if (!ruleFunction || typeof ruleFunction !== 'function') { logger.warn('checkPropTypes should have a function type rule argument'); diff --git a/packages/utils/src/check-types/index.ts b/packages/utils/src/check-types/index.ts index 507259b2c5..bdd6505103 100644 --- a/packages/utils/src/check-types/index.ts +++ b/packages/utils/src/check-types/index.ts @@ -1,4 +1,4 @@ -// 此模块存放 @alilc/lowcode-types 中类型相关判断工具 +// 此模块存放 @felce/lowcode-types 中类型相关判断工具 export * from './is-action-content-object'; export * from './is-custom-view'; export * from './is-dom-text'; @@ -25,4 +25,4 @@ export * from './is-lowcode-component-type'; export * from './is-lowcode-project-schema'; export * from './is-component-schema'; export * from './is-basic-prop-type'; -export * from './is-required-prop-type'; \ No newline at end of file +export * from './is-required-prop-type'; diff --git a/packages/utils/src/check-types/is-action-content-object.ts b/packages/utils/src/check-types/is-action-content-object.ts index 8fe31b5bd7..cb0d0bbc38 100644 --- a/packages/utils/src/check-types/is-action-content-object.ts +++ b/packages/utils/src/check-types/is-action-content-object.ts @@ -1,4 +1,4 @@ -import { IPublicTypeActionContentObject } from '@alilc/lowcode-types'; +import { IPublicTypeActionContentObject } from '@felce/lowcode-types'; import { isObject } from '../is-object'; export function isActionContentObject(obj: any): obj is IPublicTypeActionContentObject { diff --git a/packages/utils/src/check-types/is-basic-prop-type.ts b/packages/utils/src/check-types/is-basic-prop-type.ts index fd3b1b1dcb..20c17e9529 100644 --- a/packages/utils/src/check-types/is-basic-prop-type.ts +++ b/packages/utils/src/check-types/is-basic-prop-type.ts @@ -1,8 +1,8 @@ -import { IPublicTypeBasicType, IPublicTypePropType } from '@alilc/lowcode-types'; +import { IPublicTypeBasicType, IPublicTypePropType } from '@felce/lowcode-types'; export function isBasicPropType(propType: IPublicTypePropType): propType is IPublicTypeBasicType { if (!propType) { return false; } return typeof propType === 'string'; -} \ No newline at end of file +} diff --git a/packages/utils/src/check-types/is-component-schema.ts b/packages/utils/src/check-types/is-component-schema.ts index 508d153b93..62cf75a34d 100644 --- a/packages/utils/src/check-types/is-component-schema.ts +++ b/packages/utils/src/check-types/is-component-schema.ts @@ -1,8 +1,8 @@ -import { IPublicTypeComponentSchema } from "@alilc/lowcode-types"; +import { IPublicTypeComponentSchema } from '@felce/lowcode-types'; export function isComponentSchema(schema: any): schema is IPublicTypeComponentSchema { if (typeof schema === 'object') { return schema.componentName === 'Component'; } - return false + return false; } diff --git a/packages/utils/src/check-types/is-custom-view.ts b/packages/utils/src/check-types/is-custom-view.ts index 4cf921d9c5..60e2205206 100644 --- a/packages/utils/src/check-types/is-custom-view.ts +++ b/packages/utils/src/check-types/is-custom-view.ts @@ -1,6 +1,6 @@ import { isValidElement } from 'react'; import { isReactComponent } from '../is-react'; -import { IPublicTypeCustomView } from '@alilc/lowcode-types'; +import { IPublicTypeCustomView } from '@felce/lowcode-types'; export function isCustomView(obj: any): obj is IPublicTypeCustomView { if (!obj) { diff --git a/packages/utils/src/check-types/is-drag-any-object.ts b/packages/utils/src/check-types/is-drag-any-object.ts index 8711b4e333..3dd901a831 100644 --- a/packages/utils/src/check-types/is-drag-any-object.ts +++ b/packages/utils/src/check-types/is-drag-any-object.ts @@ -1,9 +1,11 @@ -import { IPublicEnumDragObjectType } from '@alilc/lowcode-types'; +import { IPublicEnumDragObjectType } from '@felce/lowcode-types'; import { isObject } from '../is-object'; export function isDragAnyObject(obj: any): boolean { if (!isObject(obj)) { return false; } - return obj.type !== IPublicEnumDragObjectType.NodeData && obj.type !== IPublicEnumDragObjectType.Node; -} \ No newline at end of file + return ( + obj.type !== IPublicEnumDragObjectType.NodeData && obj.type !== IPublicEnumDragObjectType.Node + ); +} diff --git a/packages/utils/src/check-types/is-drag-node-data-object.ts b/packages/utils/src/check-types/is-drag-node-data-object.ts index aa62f5b1c9..a02569bf1a 100644 --- a/packages/utils/src/check-types/is-drag-node-data-object.ts +++ b/packages/utils/src/check-types/is-drag-node-data-object.ts @@ -1,4 +1,4 @@ -import { IPublicEnumDragObjectType, IPublicTypeDragNodeDataObject } from '@alilc/lowcode-types'; +import { IPublicEnumDragObjectType, IPublicTypeDragNodeDataObject } from '@felce/lowcode-types'; import { isObject } from '../is-object'; export function isDragNodeDataObject(obj: any): obj is IPublicTypeDragNodeDataObject { @@ -6,4 +6,4 @@ export function isDragNodeDataObject(obj: any): obj is IPublicTypeDragNodeDataOb return false; } return obj.type === IPublicEnumDragObjectType.NodeData; -} \ No newline at end of file +} diff --git a/packages/utils/src/check-types/is-drag-node-object.ts b/packages/utils/src/check-types/is-drag-node-object.ts index 3a29ec967f..79610bd1d3 100644 --- a/packages/utils/src/check-types/is-drag-node-object.ts +++ b/packages/utils/src/check-types/is-drag-node-object.ts @@ -1,9 +1,15 @@ -import { IPublicEnumDragObjectType, IPublicModelNode, IPublicTypeDragNodeObject } from '@alilc/lowcode-types'; +import { + IPublicEnumDragObjectType, + IPublicModelNode, + IPublicTypeDragNodeObject, +} from '@felce/lowcode-types'; import { isObject } from '../is-object'; -export function isDragNodeObject<Node = IPublicModelNode>(obj: any): obj is IPublicTypeDragNodeObject<Node> { +export function isDragNodeObject<Node = IPublicModelNode>( + obj: any, +): obj is IPublicTypeDragNodeObject<Node> { if (!isObject(obj)) { return false; } return obj.type === IPublicEnumDragObjectType.Node; -} \ No newline at end of file +} diff --git a/packages/utils/src/check-types/is-dynamic-setter.ts b/packages/utils/src/check-types/is-dynamic-setter.ts index 35f8ff3892..23cf3a91c0 100644 --- a/packages/utils/src/check-types/is-dynamic-setter.ts +++ b/packages/utils/src/check-types/is-dynamic-setter.ts @@ -1,6 +1,6 @@ import { isFunction } from '../is-function'; import { isReactClass } from '../is-react'; -import { IPublicTypeDynamicSetter } from '@alilc/lowcode-types'; +import { IPublicTypeDynamicSetter } from '@felce/lowcode-types'; export function isDynamicSetter(obj: any): obj is IPublicTypeDynamicSetter { if (!isFunction(obj)) { diff --git a/packages/utils/src/check-types/is-i18n-data.ts b/packages/utils/src/check-types/is-i18n-data.ts index 793295d240..05fe222751 100644 --- a/packages/utils/src/check-types/is-i18n-data.ts +++ b/packages/utils/src/check-types/is-i18n-data.ts @@ -1,4 +1,4 @@ -import { IPublicTypeI18nData } from '@alilc/lowcode-types'; +import { IPublicTypeI18nData } from '@felce/lowcode-types'; import { isObject } from '../is-object'; export function isI18nData(obj: any): obj is IPublicTypeI18nData { diff --git a/packages/utils/src/check-types/is-isfunction.ts b/packages/utils/src/check-types/is-isfunction.ts index 64b8676637..a9673c1f08 100644 --- a/packages/utils/src/check-types/is-isfunction.ts +++ b/packages/utils/src/check-types/is-isfunction.ts @@ -1,4 +1,4 @@ -import { IPublicTypeJSFunction } from '@alilc/lowcode-types'; +import { IPublicTypeJSFunction } from '@felce/lowcode-types'; import { isObject } from '../is-object'; interface InnerJsFunction { diff --git a/packages/utils/src/check-types/is-jsblock.ts b/packages/utils/src/check-types/is-jsblock.ts index 858f5c09cd..7a332755ac 100644 --- a/packages/utils/src/check-types/is-jsblock.ts +++ b/packages/utils/src/check-types/is-jsblock.ts @@ -1,4 +1,4 @@ -import { IPublicTypeJSBlock } from '@alilc/lowcode-types'; +import { IPublicTypeJSBlock } from '@felce/lowcode-types'; import { isObject } from '../is-object'; export function isJSBlock(data: any): data is IPublicTypeJSBlock { diff --git a/packages/utils/src/check-types/is-jsexpression.ts b/packages/utils/src/check-types/is-jsexpression.ts index 16b8f4ac2a..ab2db32561 100644 --- a/packages/utils/src/check-types/is-jsexpression.ts +++ b/packages/utils/src/check-types/is-jsexpression.ts @@ -1,4 +1,4 @@ -import { IPublicTypeJSExpression } from '@alilc/lowcode-types'; +import { IPublicTypeJSExpression } from '@felce/lowcode-types'; import { isObject } from '../is-object'; /** diff --git a/packages/utils/src/check-types/is-jsslot.ts b/packages/utils/src/check-types/is-jsslot.ts index 1fb1d819d7..95f4947693 100644 --- a/packages/utils/src/check-types/is-jsslot.ts +++ b/packages/utils/src/check-types/is-jsslot.ts @@ -1,4 +1,4 @@ -import { IPublicTypeJSSlot } from '@alilc/lowcode-types'; +import { IPublicTypeJSSlot } from '@felce/lowcode-types'; import { isObject } from '../is-object'; export function isJSSlot(data: any): data is IPublicTypeJSSlot { diff --git a/packages/utils/src/check-types/is-location-children-detail.ts b/packages/utils/src/check-types/is-location-children-detail.ts index cc093c4e4a..e88a4689a4 100644 --- a/packages/utils/src/check-types/is-location-children-detail.ts +++ b/packages/utils/src/check-types/is-location-children-detail.ts @@ -1,4 +1,7 @@ -import { IPublicTypeLocationChildrenDetail, IPublicTypeLocationDetailType } from '@alilc/lowcode-types'; +import { + IPublicTypeLocationChildrenDetail, + IPublicTypeLocationDetailType, +} from '@felce/lowcode-types'; import { isObject } from '../is-object'; export function isLocationChildrenDetail(obj: any): obj is IPublicTypeLocationChildrenDetail { @@ -6,4 +9,4 @@ export function isLocationChildrenDetail(obj: any): obj is IPublicTypeLocationCh return false; } return obj.type === IPublicTypeLocationDetailType.Children; -} \ No newline at end of file +} diff --git a/packages/utils/src/check-types/is-location-data.ts b/packages/utils/src/check-types/is-location-data.ts index dabd493fa8..38f291290d 100644 --- a/packages/utils/src/check-types/is-location-data.ts +++ b/packages/utils/src/check-types/is-location-data.ts @@ -1,4 +1,4 @@ -import { IPublicTypeLocationData } from '@alilc/lowcode-types'; +import { IPublicTypeLocationData } from '@felce/lowcode-types'; import { isObject } from '../is-object'; export function isLocationData(obj: any): obj is IPublicTypeLocationData { @@ -6,4 +6,4 @@ export function isLocationData(obj: any): obj is IPublicTypeLocationData { return false; } return 'target' in obj && 'detail' in obj; -} \ No newline at end of file +} diff --git a/packages/utils/src/check-types/is-lowcode-component-type.ts b/packages/utils/src/check-types/is-lowcode-component-type.ts index ce19c23e87..5362e7b739 100644 --- a/packages/utils/src/check-types/is-lowcode-component-type.ts +++ b/packages/utils/src/check-types/is-lowcode-component-type.ts @@ -1,7 +1,8 @@ import { isProCodeComponentType } from './is-procode-component-type'; -import { IPublicTypeComponentMap, IPublicTypeLowCodeComponent } from '@alilc/lowcode-types'; +import { IPublicTypeComponentMap, IPublicTypeLowCodeComponent } from '@felce/lowcode-types'; - -export function isLowCodeComponentType(desc: IPublicTypeComponentMap): desc is IPublicTypeLowCodeComponent { +export function isLowCodeComponentType( + desc: IPublicTypeComponentMap, +): desc is IPublicTypeLowCodeComponent { return !isProCodeComponentType(desc); } diff --git a/packages/utils/src/check-types/is-lowcode-project-schema.ts b/packages/utils/src/check-types/is-lowcode-project-schema.ts index 230911f0f3..52952850c9 100644 --- a/packages/utils/src/check-types/is-lowcode-project-schema.ts +++ b/packages/utils/src/check-types/is-lowcode-project-schema.ts @@ -1,8 +1,10 @@ -import { IPublicTypeComponentSchema, IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import { IPublicTypeComponentSchema, IPublicTypeProjectSchema } from '@felce/lowcode-types'; import { isComponentSchema } from './is-component-schema'; import { isObject } from '../is-object'; -export function isLowcodeProjectSchema(data: any): data is IPublicTypeProjectSchema<IPublicTypeComponentSchema> { +export function isLowcodeProjectSchema( + data: any, +): data is IPublicTypeProjectSchema<IPublicTypeComponentSchema> { if (!isObject(data)) { return false; } diff --git a/packages/utils/src/check-types/is-node-schema.ts b/packages/utils/src/check-types/is-node-schema.ts index 253c05a080..a28681b255 100644 --- a/packages/utils/src/check-types/is-node-schema.ts +++ b/packages/utils/src/check-types/is-node-schema.ts @@ -1,4 +1,4 @@ -import { IPublicTypeNodeSchema } from '@alilc/lowcode-types'; +import { IPublicTypeNodeSchema } from '@felce/lowcode-types'; import { isObject } from '../is-object'; export function isNodeSchema(data: any): data is IPublicTypeNodeSchema { diff --git a/packages/utils/src/check-types/is-node.ts b/packages/utils/src/check-types/is-node.ts index b4690ddff9..dd2727bee3 100644 --- a/packages/utils/src/check-types/is-node.ts +++ b/packages/utils/src/check-types/is-node.ts @@ -1,4 +1,4 @@ -import { IPublicModelNode } from '@alilc/lowcode-types'; +import { IPublicModelNode } from '@felce/lowcode-types'; import { isObject } from '../is-object'; export function isNode<Node = IPublicModelNode>(node: any): node is Node { @@ -6,4 +6,4 @@ export function isNode<Node = IPublicModelNode>(node: any): node is Node { return false; } return node.isNode; -} \ No newline at end of file +} diff --git a/packages/utils/src/check-types/is-procode-component-type.ts b/packages/utils/src/check-types/is-procode-component-type.ts index 46618dcd5a..43db464639 100644 --- a/packages/utils/src/check-types/is-procode-component-type.ts +++ b/packages/utils/src/check-types/is-procode-component-type.ts @@ -1,7 +1,9 @@ -import { IPublicTypeComponentMap, IPublicTypeProCodeComponent } from '@alilc/lowcode-types'; +import { IPublicTypeComponentMap, IPublicTypeProCodeComponent } from '@felce/lowcode-types'; import { isObject } from '../is-object'; -export function isProCodeComponentType(desc: IPublicTypeComponentMap): desc is IPublicTypeProCodeComponent { +export function isProCodeComponentType( + desc: IPublicTypeComponentMap, +): desc is IPublicTypeProCodeComponent { if (!isObject(desc)) { return false; } diff --git a/packages/utils/src/check-types/is-project-schema.ts b/packages/utils/src/check-types/is-project-schema.ts index d217acd9ee..3ef4cff9f7 100644 --- a/packages/utils/src/check-types/is-project-schema.ts +++ b/packages/utils/src/check-types/is-project-schema.ts @@ -1,4 +1,4 @@ -import { IPublicTypeProjectSchema } from '@alilc/lowcode-types'; +import { IPublicTypeProjectSchema } from '@felce/lowcode-types'; import { isObject } from '../is-object'; export function isProjectSchema(data: any): data is IPublicTypeProjectSchema { diff --git a/packages/utils/src/check-types/is-required-prop-type.ts b/packages/utils/src/check-types/is-required-prop-type.ts index 106da78a00..21d300a893 100644 --- a/packages/utils/src/check-types/is-required-prop-type.ts +++ b/packages/utils/src/check-types/is-required-prop-type.ts @@ -1,8 +1,16 @@ -import { IPublicTypePropType, IPublicTypeRequiredType } from '@alilc/lowcode-types'; +import { IPublicTypePropType, IPublicTypeRequiredType } from '@felce/lowcode-types'; -export function isRequiredPropType(propType: IPublicTypePropType): propType is IPublicTypeRequiredType { +export function isRequiredPropType( + propType: IPublicTypePropType, +): propType is IPublicTypeRequiredType { if (!propType) { return false; } - return typeof propType === 'object' && propType.type && ['array', 'bool', 'func', 'number', 'object', 'string', 'node', 'element', 'any'].includes(propType.type); -} \ No newline at end of file + return ( + typeof propType === 'object' && + propType.type && + ['array', 'bool', 'func', 'number', 'object', 'string', 'node', 'element', 'any'].includes( + propType.type, + ) + ); +} diff --git a/packages/utils/src/check-types/is-setter-config.ts b/packages/utils/src/check-types/is-setter-config.ts index 98d835f32c..24ad62781d 100644 --- a/packages/utils/src/check-types/is-setter-config.ts +++ b/packages/utils/src/check-types/is-setter-config.ts @@ -1,4 +1,4 @@ -import { IPublicTypeSetterConfig } from '@alilc/lowcode-types'; +import { IPublicTypeSetterConfig } from '@felce/lowcode-types'; import { isCustomView } from './is-custom-view'; import { isObject } from '../is-object'; diff --git a/packages/utils/src/check-types/is-setting-field.ts b/packages/utils/src/check-types/is-setting-field.ts index 0d6e21d848..2418db5952 100644 --- a/packages/utils/src/check-types/is-setting-field.ts +++ b/packages/utils/src/check-types/is-setting-field.ts @@ -1,4 +1,4 @@ -import { IPublicModelSettingField } from '@alilc/lowcode-types'; +import { IPublicModelSettingField } from '@felce/lowcode-types'; import { isObject } from '../is-object'; export function isSettingField(obj: any): obj is IPublicModelSettingField { diff --git a/packages/utils/src/check-types/is-title-config.ts b/packages/utils/src/check-types/is-title-config.ts index 460da99790..c0e0b43381 100644 --- a/packages/utils/src/check-types/is-title-config.ts +++ b/packages/utils/src/check-types/is-title-config.ts @@ -1,4 +1,4 @@ -import { IPublicTypeTitleConfig } from '@alilc/lowcode-types'; +import { IPublicTypeTitleConfig } from '@felce/lowcode-types'; import { isI18nData } from './is-i18n-data'; import { isPlainObject } from '../is-plain-object'; diff --git a/packages/utils/src/context-menu.tsx b/packages/utils/src/context-menu.tsx index 185abbb343..4bf15bdcfb 100644 --- a/packages/utils/src/context-menu.tsx +++ b/packages/utils/src/context-menu.tsx @@ -1,6 +1,12 @@ import { Menu, Icon } from '@alifd/next'; -import { IPublicEnumContextMenuType, IPublicModelNode, IPublicModelPluginContext, IPublicTypeContextMenuAction, IPublicTypeContextMenuItem } from '@alilc/lowcode-types'; -import { Logger } from '@alilc/lowcode-utils'; +import { + IPublicEnumContextMenuType, + IPublicModelNode, + IPublicModelPluginContext, + IPublicTypeContextMenuAction, + IPublicTypeContextMenuItem, +} from '@felce/lowcode-types'; +import { Logger } from '@felce/lowcode-utils'; import classNames from 'classnames'; import React from 'react'; import './context-menu.scss'; @@ -24,9 +30,7 @@ const Tree = (props: { const { node } = props; if (!node) { - return ( - <div className="engine-context-menu-tree-wrap">{ props.children }</div> - ); + return <div className="engine-context-menu-tree-wrap">{props.children}</div>; } const { common } = props.options.pluginContext || {}; @@ -40,7 +44,7 @@ const Tree = (props: { }; return ( - <Tree {...props} node={node.parent} > + <Tree {...props} node={node.parent}> <div className="engine-context-menu-title" onClick={() => { @@ -49,21 +53,22 @@ const Tree = (props: { }} style={style} > - {props.options.nodes?.[0].id === node.id ? (<Icon className="engine-context-menu-tree-selecte-icon" size="small" type="success" />) : null} + {props.options.nodes?.[0].id === node.id ? ( + <Icon className="engine-context-menu-tree-selecte-icon" size="small" type="success" /> + ) : null} {intl(node.title)} </div> - <div - className="engine-context-menu-tree-children" - > - { props.children } - </div> + <div className="engine-context-menu-tree-children">{props.children}</div> </Tree> ); }; let destroyFn: Function | undefined; -export function parseContextMenuAsReactNode(menus: IPublicTypeContextMenuItem[], options: IOptions): React.ReactNode[] { +export function parseContextMenuAsReactNode( + menus: IPublicTypeContextMenuItem[], + options: IOptions, +): React.ReactNode[] { const { common, commonUI } = options.pluginContext || {}; const { intl = (title: any) => title } = common?.utils || {}; const { HelpTip } = commonUI || {}; @@ -77,7 +82,7 @@ export function parseContextMenuAsReactNode(menus: IPublicTypeContextMenuItem[], if (menu.type === IPublicEnumContextMenuType.MENU_ITEM) { if (menu.items && menu.items.length) { - children.push(( + children.push( <PopupItem className={classNames('engine-context-menu-item', { disabled: menu.disabled, @@ -86,12 +91,12 @@ export function parseContextMenuAsReactNode(menus: IPublicTypeContextMenuItem[], label={<div className="engine-context-menu-text">{intl(menu.title)}</div>} > <Menu className="next-context engine-context-menu"> - { parseContextMenuAsReactNode(menu.items, options) } + {parseContextMenuAsReactNode(menu.items, options)} </Menu> - </PopupItem> - )); + </PopupItem>, + ); } else { - children.push(( + children.push( <Item className={classNames('engine-context-menu-item', { disabled: menu.disabled, @@ -103,27 +108,29 @@ export function parseContextMenuAsReactNode(menus: IPublicTypeContextMenuItem[], key={menu.name} > <div className="engine-context-menu-text"> - { menu.title ? intl(menu.title) : null } - { menu.help ? <HelpTip size="xs" help={menu.help} direction="right" /> : null } + {menu.title ? intl(menu.title) : null} + {menu.help ? <HelpTip size="xs" help={menu.help} direction="right" /> : null} </div> - </Item> - )); + </Item>, + ); } } if (menu.type === IPublicEnumContextMenuType.NODE_TREE) { - children.push(( - <Tree node={options.nodes?.[0]} options={options} /> - )); + children.push(<Tree node={options.nodes?.[0]} options={options} />); } }); return children; } -export function parseContextMenuProperties(menus: (IPublicTypeContextMenuAction | Omit<IPublicTypeContextMenuAction, 'items'>)[], options: IOptions & { - event?: MouseEvent; -}, level = 1): IPublicTypeContextMenuItem[] { +export function parseContextMenuProperties( + menus: (IPublicTypeContextMenuAction | Omit<IPublicTypeContextMenuAction, 'items'>)[], + options: IOptions & { + event?: MouseEvent; + }, + level = 1, +): IPublicTypeContextMenuItem[] { destroyFn?.(); const { nodes, destroy } = options; @@ -133,14 +140,9 @@ export function parseContextMenuProperties(menus: (IPublicTypeContextMenuAction } return menus - .filter(menu => !menu.condition || (menu.condition && menu.condition(nodes || []))) + .filter((menu) => !menu.condition || (menu.condition && menu.condition(nodes || []))) .map((menu) => { - const { - name, - title, - type = IPublicEnumContextMenuType.MENU_ITEM, - help, - } = menu; + const { name, title, type = IPublicEnumContextMenuType.MENU_ITEM, help } = menu; const result: IPublicTypeContextMenuItem = { name, @@ -151,7 +153,7 @@ export function parseContextMenuProperties(menus: (IPublicTypeContextMenuAction destroy?.(); menu.action?.(nodes || [], options.event); }, - disabled: menu.disabled && menu.disabled(nodes || []) || false, + disabled: (menu.disabled && menu.disabled(nodes || [])) || false, }; if ('items' in menu && menu.items) { @@ -169,7 +171,7 @@ export function parseContextMenuProperties(menus: (IPublicTypeContextMenuAction return menus.concat([currentMenu]); } - const index = menus.find(item => item.name === currentMenu.name); + const index = menus.find((item) => item.name === currentMenu.name); if (!index) { return menus.concat([currentMenu]); } else { @@ -192,20 +194,29 @@ function getMenuItemHeight() { return menuItemHeight; } -export function createContextMenu(children: React.ReactNode[], { - event, - offset = [0, 0], -}: { - event: MouseEvent | React.MouseEvent; - offset?: [number, number]; -}) { +export function createContextMenu( + children: React.ReactNode[], + { + event, + offset = [0, 0], + }: { + event: MouseEvent | React.MouseEvent; + offset?: [number, number]; + }, +) { event.preventDefault(); event.stopPropagation(); const viewportWidth = window.innerWidth; const viewportHeight = window.innerHeight; - const dividerCount = React.Children.count(children.filter(child => React.isValidElement(child) && child.type === Divider)); - const popupItemCount = React.Children.count(children.filter(child => React.isValidElement(child) && (child.type === PopupItem || child.type === Item))); + const dividerCount = React.Children.count( + children.filter((child) => React.isValidElement(child) && child.type === Divider), + ); + const popupItemCount = React.Children.count( + children.filter( + (child) => React.isValidElement(child) && (child.type === PopupItem || child.type === Item), + ), + ); const menuHeight = popupItemCount * parseInt(getMenuItemHeight(), 10) + dividerCount * 8 + 16; const menuWidthLimit = 200; let x = event.clientX + offset[0]; @@ -227,4 +238,4 @@ export function createContextMenu(children: React.ReactNode[], { destroyFn = (menuInstance as any).destroy; return destroyFn; -} \ No newline at end of file +} diff --git a/packages/utils/src/create-icon.tsx b/packages/utils/src/create-icon.tsx index 621b5c7ab4..3155127745 100644 --- a/packages/utils/src/create-icon.tsx +++ b/packages/utils/src/create-icon.tsx @@ -1,15 +1,15 @@ import { isValidElement, ReactNode, createElement, cloneElement } from 'react'; import { Icon } from '@alifd/next'; -import { IPublicTypeIconType } from '@alilc/lowcode-types'; +import { IPublicTypeIconType } from '@felce/lowcode-types'; import { isReactComponent } from './is-react'; import { isESModule } from './is-es-module'; const URL_RE = /^(https?:)\/\//i; export function createIcon( - icon?: IPublicTypeIconType | null, - props?: Record<string, unknown>, - ): ReactNode { + icon?: IPublicTypeIconType | null, + props?: Record<string, unknown>, +): ReactNode { if (!icon) { return null; } diff --git a/packages/utils/src/misc.ts b/packages/utils/src/misc.ts index 28833ef321..d287634b13 100644 --- a/packages/utils/src/misc.ts +++ b/packages/utils/src/misc.ts @@ -1,7 +1,6 @@ - import { isI18NObject } from './is-object'; import { get } from 'lodash'; -import { IPublicEnumTransformStage, IPublicModelComponentMeta } from '@alilc/lowcode-types'; +import { IPublicEnumTransformStage, IPublicModelComponentMeta } from '@felce/lowcode-types'; import { Logger } from './logger'; const logger = new Logger({ level: 'warn', bizName: 'utils' }); @@ -22,7 +21,7 @@ export function isVariable(obj: any): obj is Variable { export function isUseI18NSetter(prototype: any, propName: string) { const configure = prototype?.options?.configure; if (Array.isArray(configure)) { - return configure.some(c => { + return configure.some((c) => { return c.name === propName && c?.setter?.type?.displayName === 'I18nSetter'; }); } @@ -64,14 +63,14 @@ export function waitForThing(obj: any, path: string): Promise<any> { export function arrShallowEquals(arr1: any[], arr2: any[]): boolean { if (!Array.isArray(arr1) || !Array.isArray(arr2)) return false; if (arr1.length !== arr2.length) return false; - return arr1.every(item => arr2.includes(item)); + return arr1.every((item) => arr2.includes(item)); } /** * 判断当前 meta 是否从 vc prototype 转换而来 * @param meta */ - export function isFromVC(meta: IPublicModelComponentMeta) { +export function isFromVC(meta: IPublicModelComponentMeta) { return !!meta?.getMetadata().configure?.advanced; } @@ -79,14 +78,7 @@ export function executePendingFn(fn: () => void, timeout: number = 2000) { return setTimeout(fn, timeout); } -const stageList = [ - 'render', - 'serilize', - 'save', - 'clone', - 'init', - 'upgrade', -]; +const stageList = ['render', 'serilize', 'save', 'clone', 'init', 'upgrade']; /** * 兼容原来的数字版本的枚举对象 @@ -95,7 +87,9 @@ const stageList = [ */ export function compatStage(stage: IPublicEnumTransformStage | number): IPublicEnumTransformStage { if (typeof stage === 'number') { - console.warn('stage 直接指定为数字的使用方式已经过时,将在下一版本移除,请直接使用 IPublicEnumTransformStage.Render|Serilize|Save|Clone|Init|Upgrade'); + console.warn( + 'stage 直接指定为数字的使用方式已经过时,将在下一版本移除,请直接使用 IPublicEnumTransformStage.Render|Serilize|Save|Clone|Init|Upgrade', + ); return stageList[stage - 1] as IPublicEnumTransformStage; } return stage as IPublicEnumTransformStage; @@ -103,7 +97,7 @@ export function compatStage(stage: IPublicEnumTransformStage | number): IPublicE export function invariant(check: any, message: string, thing?: any) { if (!check) { - throw new Error(`Invariant failed: ${ message }${thing ? ` in '${thing}'` : ''}`); + throw new Error(`Invariant failed: ${message}${thing ? ` in '${thing}'` : ''}`); } } @@ -132,4 +126,4 @@ export function shouldUseVariableSetter( ) { if (propSupportVariable === false) return false; return propSupportVariable || globalSupportVariable; -} \ No newline at end of file +} diff --git a/packages/utils/src/node-helper.ts b/packages/utils/src/node-helper.ts index 60102d6794..3cfc208988 100644 --- a/packages/utils/src/node-helper.ts +++ b/packages/utils/src/node-helper.ts @@ -1,11 +1,11 @@ // 仅使用类型 -import { IPublicModelNode } from '@alilc/lowcode-types'; +import { IPublicModelNode } from '@felce/lowcode-types'; import { MouseEvent } from 'react'; export const getClosestNode = <Node extends IPublicModelNode = IPublicModelNode>( node: Node, until: (n: Node) => boolean, - ): Node | undefined => { +): Node | undefined => { if (!node) { return undefined; } @@ -23,7 +23,10 @@ export const getClosestNode = <Node extends IPublicModelNode = IPublicModelNode> * @param {unknown} e 点击事件 * @returns {boolean} 是否可点击,true表示可点击 */ -export function canClickNode<Node extends IPublicModelNode = IPublicModelNode>(node: Node, e: MouseEvent): boolean { +export function canClickNode<Node extends IPublicModelNode = IPublicModelNode>( + node: Node, + e: MouseEvent, +): boolean { const onClickHook = node.componentMeta?.advanced?.callbacks?.onClickHook; const canClick = typeof onClickHook === 'function' ? onClickHook(e, node) : true; return canClick; diff --git a/packages/utils/src/schema.ts b/packages/utils/src/schema.ts index 2e7dec70fa..caeaeaa5e0 100644 --- a/packages/utils/src/schema.ts +++ b/packages/utils/src/schema.ts @@ -1,4 +1,4 @@ -import { ActivityType, IPublicTypeNodeSchema, IPublicTypeRootSchema } from '@alilc/lowcode-types'; +import { ActivityType, IPublicTypeNodeSchema, IPublicTypeRootSchema } from '@felce/lowcode-types'; import { isJSBlock, isJSSlot } from './check-types'; import { isVariable } from './misc'; import { isPlainObject } from './is-plain-object'; @@ -23,7 +23,7 @@ export function compatibleLegaoSchema(props: any): any { } if (Array.isArray(props)) { - return props.map(k => compatibleLegaoSchema(k)); + return props.map((k) => compatibleLegaoSchema(k)); } if (!isPlainObject(props)) { @@ -78,7 +78,10 @@ export function compatibleLegaoSchema(props: any): any { return newProps; } -export function getNodeSchemaById(schema: IPublicTypeNodeSchema, nodeId: string): IPublicTypeNodeSchema | undefined { +export function getNodeSchemaById( + schema: IPublicTypeNodeSchema, + nodeId: string, +): IPublicTypeNodeSchema | undefined { let found: IPublicTypeNodeSchema | undefined; if (schema.id === nodeId) { return schema; @@ -123,7 +126,10 @@ function getNodeSchemaFromPropsById(props: any, nodeId: string): IPublicTypeNode * TODO: not sure if this is used anywhere * @deprecated */ -export function applyActivities(pivotSchema: IPublicTypeRootSchema, activities: any): IPublicTypeRootSchema { +export function applyActivities( + pivotSchema: IPublicTypeRootSchema, + activities: any, +): IPublicTypeRootSchema { let schema = { ...pivotSchema }; if (!Array.isArray(activities)) { activities = [activities]; diff --git a/packages/utils/src/transaction-manager.ts b/packages/utils/src/transaction-manager.ts index 85161eff9f..075883e8fe 100644 --- a/packages/utils/src/transaction-manager.ts +++ b/packages/utils/src/transaction-manager.ts @@ -1,24 +1,33 @@ -import { IPublicEnumTransitionType } from '@alilc/lowcode-types'; +import { IPublicEnumTransitionType } from '@felce/lowcode-types'; import { runInAction } from 'mobx'; import EventEmitter from 'events'; class TransactionManager { emitter = new EventEmitter(); - executeTransaction = (fn: () => void, type: IPublicEnumTransitionType = IPublicEnumTransitionType.REPAINT): void => { + executeTransaction = ( + fn: () => void, + type: IPublicEnumTransitionType = IPublicEnumTransitionType.REPAINT, + ): void => { this.emitter.emit(`[${type}]startTransaction`); runInAction(fn); this.emitter.emit(`[${type}]endTransaction`); }; - onStartTransaction = (fn: () => void, type: IPublicEnumTransitionType = IPublicEnumTransitionType.REPAINT): () => void => { + onStartTransaction = ( + fn: () => void, + type: IPublicEnumTransitionType = IPublicEnumTransitionType.REPAINT, + ): (() => void) => { this.emitter.on(`[${type}]startTransaction`, fn); return () => { this.emitter.off(`[${type}]startTransaction`, fn); }; }; - onEndTransaction = (fn: () => void, type: IPublicEnumTransitionType = IPublicEnumTransitionType.REPAINT): () => void => { + onEndTransaction = ( + fn: () => void, + type: IPublicEnumTransitionType = IPublicEnumTransitionType.REPAINT, + ): (() => void) => { this.emitter.on(`[${type}]endTransaction`, fn); return () => { this.emitter.off(`[${type}]endTransaction`, fn); diff --git a/packages/utils/src/workspace.tsx b/packages/utils/src/workspace.tsx index 446530ce8e..8729bd61ad 100644 --- a/packages/utils/src/workspace.tsx +++ b/packages/utils/src/workspace.tsx @@ -1,5 +1,10 @@ import React, { useEffect, useState, useCallback } from 'react'; -import { IPublicModelPluginContext, IPublicEnumPluginRegisterLevel, IPublicModelWindow, IPublicModelEditorView } from '@alilc/lowcode-types'; +import { + IPublicModelPluginContext, + IPublicEnumPluginRegisterLevel, + IPublicModelWindow, + IPublicModelEditorView, +} from '@felce/lowcode-types'; /** * 高阶组件(HOC):为组件提供 view 插件上下文。 @@ -24,7 +29,11 @@ export const ProvideViewPluginContext = (Component: any, viewName?: string | str return null; } if (viewName) { - const items = editorWindow?.editorViews.filter(d => (d as any).viewName === viewName || (Array.isArray(viewName) && viewName.includes((d as any).viewName))); + const items = editorWindow?.editorViews.filter( + (d) => + (d as any).viewName === viewName || + (Array.isArray(viewName) && viewName.includes((d as any).viewName)), + ); return items[0]; } else { return editorWindow.currentEditorView; @@ -32,7 +41,9 @@ export const ProvideViewPluginContext = (Component: any, viewName?: string | str }, []); const { workspace } = props.pluginContext || {}; - const [pluginContext, setPluginContext] = useState<IPublicModelEditorView | null>(getPluginContextFun(workspace?.window)); + const [pluginContext, setPluginContext] = useState<IPublicModelEditorView | null>( + getPluginContextFun(workspace?.window), + ); useEffect(() => { if (workspace?.window) { @@ -45,7 +56,10 @@ export const ProvideViewPluginContext = (Component: any, viewName?: string | str }); }, [workspace, getPluginContextFun]); - if (props.pluginContext?.registerLevel !== IPublicEnumPluginRegisterLevel.Workspace || !props.pluginContext) { + if ( + props.pluginContext?.registerLevel !== IPublicEnumPluginRegisterLevel.Workspace || + !props.pluginContext + ) { return <Component {...props} />; } diff --git a/packages/utils/test/src/check-types/is-custom-view.test.tsx b/packages/utils/test/src/check-types/is-custom-view.test.tsx index 62c08780e6..617c2ffb83 100644 --- a/packages/utils/test/src/check-types/is-custom-view.test.tsx +++ b/packages/utils/test/src/check-types/is-custom-view.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { isCustomView } from '../../../src/check-types/is-custom-view'; -import { IPublicTypeCustomView } from '@alilc/lowcode-types'; +import { IPublicTypeCustomView } from '@felce/lowcode-types'; describe('isCustomView', () => { test('should return true when obj is a valid React element', () => { diff --git a/packages/utils/test/src/check-types/is-drag-any-object.test.ts b/packages/utils/test/src/check-types/is-drag-any-object.test.ts index 6a835f2be3..33ecab0c69 100644 --- a/packages/utils/test/src/check-types/is-drag-any-object.test.ts +++ b/packages/utils/test/src/check-types/is-drag-any-object.test.ts @@ -1,5 +1,5 @@ import { isDragAnyObject } from '../../../src/check-types/is-drag-any-object'; -import { IPublicEnumDragObjectType } from '@alilc/lowcode-types'; +import { IPublicEnumDragObjectType } from '@felce/lowcode-types'; describe('isDragAnyObject', () => { it('should return false if obj is null', () => { diff --git a/packages/utils/test/src/check-types/is-drag-node-data-object.test.ts b/packages/utils/test/src/check-types/is-drag-node-data-object.test.ts index 92867843a2..be7de7305a 100644 --- a/packages/utils/test/src/check-types/is-drag-node-data-object.test.ts +++ b/packages/utils/test/src/check-types/is-drag-node-data-object.test.ts @@ -1,4 +1,4 @@ -import { IPublicEnumDragObjectType, IPublicTypeDragNodeDataObject } from '@alilc/lowcode-types'; +import { IPublicEnumDragObjectType, IPublicTypeDragNodeDataObject } from '@felce/lowcode-types'; import { isDragNodeDataObject } from '../../../src/check-types/is-drag-node-data-object'; describe('isDragNodeDataObject', () => { diff --git a/packages/utils/test/src/check-types/is-drag-node-object.test.ts b/packages/utils/test/src/check-types/is-drag-node-object.test.ts index 3561c87885..06e1d0547f 100644 --- a/packages/utils/test/src/check-types/is-drag-node-object.test.ts +++ b/packages/utils/test/src/check-types/is-drag-node-object.test.ts @@ -1,4 +1,4 @@ -import { IPublicEnumDragObjectType } from '@alilc/lowcode-types'; +import { IPublicEnumDragObjectType } from '@felce/lowcode-types'; import { isDragNodeObject } from '../../../src/check-types/is-drag-node-object'; describe('isDragNodeObject', () => { diff --git a/packages/utils/test/src/check-types/is-i18n-data.test.ts b/packages/utils/test/src/check-types/is-i18n-data.test.ts index 2e903a2ed2..f01709e59d 100644 --- a/packages/utils/test/src/check-types/is-i18n-data.test.ts +++ b/packages/utils/test/src/check-types/is-i18n-data.test.ts @@ -1,5 +1,5 @@ import { isI18nData } from '../../../src/check-types/is-i18n-data'; -import { IPublicTypeI18nData } from "@alilc/lowcode-types"; +import { IPublicTypeI18nData } from '@felce/lowcode-types'; describe('isI18nData', () => { it('should return true for valid i18n data', () => { diff --git a/packages/utils/test/src/check-types/is-jsslot.test.ts b/packages/utils/test/src/check-types/is-jsslot.test.ts index 5c130cddfd..6bd9c092ac 100644 --- a/packages/utils/test/src/check-types/is-jsslot.test.ts +++ b/packages/utils/test/src/check-types/is-jsslot.test.ts @@ -1,5 +1,5 @@ import { isJSSlot } from '../../../src/check-types/is-jsslot'; -import { IPublicTypeJSSlot } from '@alilc/lowcode-types'; +import { IPublicTypeJSSlot } from '@felce/lowcode-types'; describe('isJSSlot', () => { it('should return true when input is of type IPublicTypeJSSlot', () => { diff --git a/packages/utils/test/src/check-types/is-location-children-detail.test.ts b/packages/utils/test/src/check-types/is-location-children-detail.test.ts index f209e8e63f..58afd26588 100644 --- a/packages/utils/test/src/check-types/is-location-children-detail.test.ts +++ b/packages/utils/test/src/check-types/is-location-children-detail.test.ts @@ -1,5 +1,8 @@ import { isLocationChildrenDetail } from '../../../src/check-types/is-location-children-detail'; -import { IPublicTypeLocationChildrenDetail, IPublicTypeLocationDetailType } from '@alilc/lowcode-types'; +import { + IPublicTypeLocationChildrenDetail, + IPublicTypeLocationDetailType, +} from '@felce/lowcode-types'; describe('isLocationChildrenDetail', () => { it('should return true when obj is IPublicTypeLocationChildrenDetail', () => { diff --git a/packages/utils/test/src/check-types/is-location-data.test.ts b/packages/utils/test/src/check-types/is-location-data.test.ts index ba2e2c8be0..1985f43c0a 100644 --- a/packages/utils/test/src/check-types/is-location-data.test.ts +++ b/packages/utils/test/src/check-types/is-location-data.test.ts @@ -1,5 +1,5 @@ import { isLocationData } from '../../../src/check-types/is-location-data'; -import { IPublicTypeLocationData } from '@alilc/lowcode-types'; +import { IPublicTypeLocationData } from '@felce/lowcode-types'; describe('isLocationData', () => { it('should return true when obj is valid location data', () => { diff --git a/packages/utils/test/src/check-types/is-lowcode-component-type.test.ts b/packages/utils/test/src/check-types/is-lowcode-component-type.test.ts index 35b76f00b5..3ee1845505 100644 --- a/packages/utils/test/src/check-types/is-lowcode-component-type.test.ts +++ b/packages/utils/test/src/check-types/is-lowcode-component-type.test.ts @@ -1,5 +1,5 @@ import { isLowCodeComponentType } from '../../../src/check-types/is-lowcode-component-type'; -import { IPublicTypeLowCodeComponent, IPublicTypeProCodeComponent } from '@alilc/lowcode-types'; +import { IPublicTypeLowCodeComponent, IPublicTypeProCodeComponent } from '@felce/lowcode-types'; describe('isLowCodeComponentType', () => { test('should return true for a low code component type', () => { @@ -13,7 +13,7 @@ describe('isLowCodeComponentType', () => { test('should return false for a pro code component type', () => { const desc: IPublicTypeProCodeComponent = { // create a valid pro code component description - package: 'pro-code' + package: 'pro-code', }; expect(isLowCodeComponentType(desc)).toBe(false); diff --git a/packages/utils/test/src/check-types/is-project-schema.test.ts b/packages/utils/test/src/check-types/is-project-schema.test.ts index 0ec3f47408..2c585f97c8 100644 --- a/packages/utils/test/src/check-types/is-project-schema.test.ts +++ b/packages/utils/test/src/check-types/is-project-schema.test.ts @@ -1,8 +1,8 @@ -import { IPublicTypeProjectSchema } from "@alilc/lowcode-types"; -import { isProjectSchema } from "../../../src/check-types/is-project-schema"; +import { IPublicTypeProjectSchema } from '@felce/lowcode-types'; +import { isProjectSchema } from '../../../src/check-types/is-project-schema'; -describe("isProjectSchema", () => { - it("should return true if data has componentsTree property", () => { +describe('isProjectSchema', () => { + it('should return true if data has componentsTree property', () => { const data: IPublicTypeProjectSchema = { // ... componentsTree: { @@ -12,14 +12,14 @@ describe("isProjectSchema", () => { expect(isProjectSchema(data)).toBe(true); }); - it("should return false if data does not have componentsTree property", () => { + it('should return false if data does not have componentsTree property', () => { const data = { // ... }; expect(isProjectSchema(data)).toBe(false); }); - it("should return false if data is null or undefined", () => { + it('should return false if data is null or undefined', () => { expect(isProjectSchema(null)).toBe(false); expect(isProjectSchema(undefined)).toBe(false); }); diff --git a/packages/utils/test/src/misc.test.ts b/packages/utils/test/src/misc.test.ts index 2514661508..bc6e976550 100644 --- a/packages/utils/test/src/misc.test.ts +++ b/packages/utils/test/src/misc.test.ts @@ -12,7 +12,7 @@ import { isRegExp, shouldUseVariableSetter, } from '../../src/misc'; -import { IPublicModelComponentMeta } from '@alilc/lowcode-types'; +import { IPublicModelComponentMeta } from '@felce/lowcode-types'; describe('isVariable', () => { it('should return true for a variable object', () => { @@ -30,14 +30,22 @@ describe('isVariable', () => { describe('isUseI18NSetter', () => { it('should return true for a property with I18nSetter', () => { - const prototype = { options: { configure: [{ name: 'propName', setter: { type: { displayName: 'I18nSetter' } } }] } }; + const prototype = { + options: { + configure: [{ name: 'propName', setter: { type: { displayName: 'I18nSetter' } } }], + }, + }; const propName = 'propName'; const result = isUseI18NSetter(prototype, propName); expect(result).toBe(true); }); it('should return false for a property without I18nSetter', () => { - const prototype = { options: { configure: [{ name: 'propName', setter: { type: { displayName: 'OtherSetter' } } }] } }; + const prototype = { + options: { + configure: [{ name: 'propName', setter: { type: { displayName: 'OtherSetter' } } }], + }, + }; const propName = 'propName'; const result = isUseI18NSetter(prototype, propName); expect(result).toBe(false); @@ -240,7 +248,7 @@ describe('executePendingFn', () => { expect(fn).not.toHaveBeenCalled(); // Wait for the specified timeout - await new Promise(resolve => setTimeout(resolve, 100)); + await new Promise((resolve) => setTimeout(resolve, 100)); // Ensure the function has been called after the timeout expect(fn).toHaveBeenCalled(); @@ -257,7 +265,7 @@ describe('executePendingFn', () => { expect(fn).not.toHaveBeenCalled(); // Wait for the default timeout (2000 milliseconds) - await new Promise(resolve => setTimeout(resolve, 2000)); + await new Promise((resolve) => setTimeout(resolve, 2000)); // Ensure the function has been called after the default timeout expect(fn).toHaveBeenCalled(); @@ -275,7 +283,7 @@ describe('compatStage', () => { const result = compatStage(2); expect(result).toBe('serilize'); expect(warnSpy).toHaveBeenCalledWith( - 'stage 直接指定为数字的使用方式已经过时,将在下一版本移除,请直接使用 IPublicEnumTransformStage.Render|Serilize|Save|Clone|Init|Upgrade' + 'stage 直接指定为数字的使用方式已经过时,将在下一版本移除,请直接使用 IPublicEnumTransformStage.Render|Serilize|Save|Clone|Init|Upgrade', ); warnSpy.mockRestore(); }); @@ -293,7 +301,7 @@ describe('invariant', () => { it('should throw an error if the check is false', () => { expect(() => invariant(false, 'Test invariant', 'thing')).toThrowError( - "Invariant failed: Test invariant in 'thing'" + "Invariant failed: Test invariant in 'thing'", ); }); }); @@ -323,4 +331,4 @@ it('shouldUseVariableSetter', () => { expect(shouldUseVariableSetter(true, false)).toBeTruthy(); expect(shouldUseVariableSetter(undefined, false)).toBeFalsy(); expect(shouldUseVariableSetter(undefined, true)).toBeTruthy(); -}); \ No newline at end of file +}); diff --git a/packages/utils/test/src/schema.test.ts b/packages/utils/test/src/schema.test.ts index 8d03f58118..b7fcfd3ba7 100644 --- a/packages/utils/test/src/schema.test.ts +++ b/packages/utils/test/src/schema.test.ts @@ -1,9 +1,5 @@ -import { - compatibleLegaoSchema, - getNodeSchemaById, - applyActivities, -} from '../../src/schema'; -import { ActivityType } from '@alilc/lowcode-types'; +import { compatibleLegaoSchema, getNodeSchemaById, applyActivities } from '../../src/schema'; +import { ActivityType } from '@felce/lowcode-types'; describe('compatibleLegaoSchema', () => { it('should handle null input', () => { @@ -126,30 +122,29 @@ describe('applyActivities', () => { // Add more test cases for other activity types and scenarios }); - describe('Schema Ut', () => { it('props', () => { const schema = { props: { mobileSlot: { - type: "JSBlock", + type: 'JSBlock', value: { - componentName: "Slot", + componentName: 'Slot', children: [ { loop: { - variable: "props.content", - type: "variable" + variable: 'props.content', + type: 'variable', }, - } + }, ], - } + }, }, }, - }; + }; const result = compatibleLegaoSchema(schema); expect(result).toMatchSnapshot(); expect(result.props.mobileSlot.value[0].loop.type).toBe('JSExpression'); }); -}) \ No newline at end of file +}); diff --git a/packages/utils/test/src/transaction-manager.test.ts b/packages/utils/test/src/transaction-manager.test.ts index 42c7fa8bf0..671b2c03d0 100644 --- a/packages/utils/test/src/transaction-manager.test.ts +++ b/packages/utils/test/src/transaction-manager.test.ts @@ -1,5 +1,5 @@ import { transactionManager } from '../../src/transaction-manager'; -import { IPublicEnumTransitionType } from '@alilc/lowcode-types'; +import { IPublicEnumTransitionType } from '@felce/lowcode-types'; const type = IPublicEnumTransitionType.REPAINT; diff --git a/packages/workspace/package.json b/packages/workspace/package.json index 778b8167f8..0383c958bc 100644 --- a/packages/workspace/package.json +++ b/packages/workspace/package.json @@ -1,6 +1,6 @@ { - "name": "@alilc/lowcode-workspace", - "version": "1.3.2", + "name": "@felce/lowcode-workspace", + "version": "1.4.0", "description": "Shell Layer for AliLowCodeEngine", "main": "lib/index.js", "module": "es/index.js", @@ -15,11 +15,11 @@ }, "license": "MIT", "dependencies": { - "@alilc/lowcode-designer": "1.3.2", - "@alilc/lowcode-editor-core": "1.3.2", - "@alilc/lowcode-editor-skeleton": "1.3.2", - "@alilc/lowcode-types": "1.3.2", - "@alilc/lowcode-utils": "1.3.2", + "@felce/lowcode-designer": "1.4.0", + "@felce/lowcode-editor-core": "1.4.0", + "@felce/lowcode-editor-skeleton": "1.4.0", + "@felce/lowcode-types": "1.4.0", + "@felce/lowcode-utils": "1.4.0", "classnames": "^2.2.6", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.5", @@ -47,9 +47,9 @@ }, "repository": { "type": "http", - "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/workspace" + "url": "https://github.com/fe-lce/lowcode-engine/tree/main/packages/workspace" }, "gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6", - "bugs": "https://github.com/alibaba/lowcode-engine/issues", - "homepage": "https://github.com/alibaba/lowcode-engine/#readme" + "bugs": "https://github.com/fe-lce/lowcode-engine/issues", + "homepage": "https://github.com/fe-lce/lowcode-engine/#readme" } diff --git a/packages/workspace/src/context/base-context.ts b/packages/workspace/src/context/base-context.ts index 445677a618..003eaea3cf 100644 --- a/packages/workspace/src/context/base-context.ts +++ b/packages/workspace/src/context/base-context.ts @@ -1,12 +1,13 @@ import { Editor, - engineConfig, Setters as InnerSetters, + engineConfig, + Setters as InnerSetters, Hotkey as InnerHotkey, commonEvent, IEngineConfig, IHotKey, Command as InnerCommand, -} from '@alilc/lowcode-editor-core'; +} from '@felce/lowcode-editor-core'; import { Designer, ILowCodePluginContextApiAssembler, @@ -15,11 +16,8 @@ import { IProject, IDesigner, ILowCodePluginManager, -} from '@alilc/lowcode-designer'; -import { - ISkeleton, - Skeleton as InnerSkeleton, -} from '@alilc/lowcode-editor-skeleton'; +} from '@felce/lowcode-designer'; +import { ISkeleton, Skeleton as InnerSkeleton } from '@felce/lowcode-editor-skeleton'; import { Hotkey, Plugins, @@ -35,7 +33,7 @@ import { Canvas, CommonUI, Command, -} from '@alilc/lowcode-shell'; +} from '@felce/lowcode-shell'; import { IPluginPreferenceMananger, IPublicApiCanvas, @@ -50,8 +48,8 @@ import { IPublicEnumPluginRegisterLevel, IPublicModelPluginContext, IPublicTypePluginMeta, -} from '@alilc/lowcode-types'; -import { getLogger, Logger as InnerLogger } from '@alilc/lowcode-utils'; +} from '@felce/lowcode-types'; +import { getLogger, Logger as InnerLogger } from '@felce/lowcode-utils'; import { IWorkspace } from '../workspace'; import { IEditorWindow } from '../window'; @@ -104,7 +102,12 @@ export class BasicContext implements IBasicContext { preference: IPluginPreferenceMananger; workspace: IWorkspace; - constructor(innerWorkspace: IWorkspace, viewName: string, readonly registerLevel: IPublicEnumPluginRegisterLevel, public editorWindow?: IEditorWindow) { + constructor( + innerWorkspace: IWorkspace, + viewName: string, + readonly registerLevel: IPublicEnumPluginRegisterLevel, + public editorWindow?: IEditorWindow, + ) { const editor = new Editor(viewName, true); const innerSkeleton = new InnerSkeleton(editor, viewName); @@ -157,7 +160,11 @@ export class BasicContext implements IBasicContext { let plugins: IPublicApiPlugins; const pluginContextApiAssembler: ILowCodePluginContextApiAssembler = { - assembleApis: (context: ILowCodePluginContextPrivate, pluginName: string, meta: IPublicTypePluginMeta) => { + assembleApis: ( + context: ILowCodePluginContextPrivate, + pluginName: string, + meta: IPublicTypePluginMeta, + ) => { context.workspace = workspace; context.hotkey = hotkey; context.project = project; @@ -180,7 +187,8 @@ export class BasicContext implements IBasicContext { commandScope, }); context.registerLevel = registerLevel; - context.isPluginRegisteredInWorkspace = registerLevel === IPublicEnumPluginRegisterLevel.Workspace; + context.isPluginRegisteredInWorkspace = + registerLevel === IPublicEnumPluginRegisterLevel.Workspace; editor.set('pluginContext', context); }, }; @@ -197,4 +205,4 @@ export class BasicContext implements IBasicContext { await innerWorkspace?.registryInnerPlugin(designer, editor, plugins); }; } -} \ No newline at end of file +} diff --git a/packages/workspace/src/context/view-context.ts b/packages/workspace/src/context/view-context.ts index 0542f83a95..98c31e99ee 100644 --- a/packages/workspace/src/context/view-context.ts +++ b/packages/workspace/src/context/view-context.ts @@ -1,5 +1,9 @@ -import { computed, makeObservable, obx } from '@alilc/lowcode-editor-core'; -import { IPublicEditorViewConfig, IPublicEnumPluginRegisterLevel, IPublicTypeEditorView } from '@alilc/lowcode-types'; +import { computed, makeObservable, obx } from '@felce/lowcode-editor-core'; +import { + IPublicEditorViewConfig, + IPublicEnumPluginRegisterLevel, + IPublicTypeEditorView, +} from '@felce/lowcode-types'; import { flow } from 'mobx'; import { IWorkspace } from '../workspace'; import { BasicContext, IBasicContext } from './base-context'; @@ -37,13 +41,21 @@ export class Context extends BasicContext implements IViewContext { this.isInit = true; }); - constructor(public workspace: IWorkspace, public editorWindow: IEditorWindow, public editorView: IPublicTypeEditorView, options: Object | undefined) { + constructor( + public workspace: IWorkspace, + public editorWindow: IEditorWindow, + public editorView: IPublicTypeEditorView, + options: Object | undefined, + ) { super(workspace, editorView.viewName, IPublicEnumPluginRegisterLevel.EditorView, editorWindow); this.viewType = editorView.viewType || 'editor'; this.viewName = editorView.viewName; - this.instance = editorView(this.innerPlugins._getLowCodePluginContext({ - pluginName: 'any', - }), options); + this.instance = editorView( + this.innerPlugins._getLowCodePluginContext({ + pluginName: 'any', + }), + options, + ); makeObservable(this); } @@ -67,4 +79,4 @@ export class Context extends BasicContext implements IViewContext { async save() { return await this.instance?.save?.(); } -} \ No newline at end of file +} diff --git a/packages/workspace/src/inner-plugins/webview.tsx b/packages/workspace/src/inner-plugins/webview.tsx index 820b843ab8..a48e7dd379 100644 --- a/packages/workspace/src/inner-plugins/webview.tsx +++ b/packages/workspace/src/inner-plugins/webview.tsx @@ -1,9 +1,6 @@ -import { IPublicModelPluginContext } from '@alilc/lowcode-types'; +import { IPublicModelPluginContext } from '@felce/lowcode-types'; -export function DesignerView(props: { - url: string; - viewName?: string; -}) { +export function DesignerView(props: { url: string; viewName?: string }) { return ( <div className="lc-designer lowcode-plugin-designer"> <div className="lc-project"> diff --git a/packages/workspace/src/layouts/workbench.tsx b/packages/workspace/src/layouts/workbench.tsx index 2913576e1c..6488c0645a 100644 --- a/packages/workspace/src/layouts/workbench.tsx +++ b/packages/workspace/src/layouts/workbench.tsx @@ -1,23 +1,34 @@ import { Component } from 'react'; -import { TipContainer, engineConfig, observer } from '@alilc/lowcode-editor-core'; +import { TipContainer, engineConfig, observer } from '@felce/lowcode-editor-core'; import { WindowView } from '../view/window-view'; import classNames from 'classnames'; import { SkeletonContext } from '../skeleton-context'; -import { EditorConfig, PluginClassSet } from '@alilc/lowcode-types'; +import { EditorConfig, PluginClassSet } from '@felce/lowcode-types'; import { Workspace } from '../workspace'; -import { BottomArea, LeftArea, LeftFixedPane, LeftFloatPane, MainArea, SubTopArea, TopArea } from '@alilc/lowcode-editor-skeleton'; +import { + BottomArea, + LeftArea, + LeftFixedPane, + LeftFloatPane, + MainArea, + SubTopArea, + TopArea, +} from '@felce/lowcode-editor-skeleton'; @observer -export class Workbench extends Component<{ - workspace: Workspace; - config?: EditorConfig; - components?: PluginClassSet; - className?: string; - topAreaItemClassName?: string; -}, { - workspaceEmptyComponent: any; - theme?: string; -}> { +export class Workbench extends Component< + { + workspace: Workspace; + config?: EditorConfig; + components?: PluginClassSet; + className?: string; + topAreaItemClassName?: string; + }, + { + workspaceEmptyComponent: any; + theme?: string; + } +> { constructor(props: any) { super(props); const { config, components, workspace } = this.props; @@ -47,7 +58,11 @@ export class Workbench extends Component<{ return ( <div className={classNames('lc-workspace-workbench', className, theme)}> <SkeletonContext.Provider value={skeleton}> - <TopArea className="lc-workspace-top-area" area={skeleton.topArea} itemClassName={topAreaItemClassName} /> + <TopArea + className="lc-workspace-top-area" + area={skeleton.topArea} + itemClassName={topAreaItemClassName} + /> <div className="lc-workspace-workbench-body"> <LeftArea className="lc-workspace-left-area lc-left-area" area={skeleton.leftArea} /> <LeftFloatPane area={skeleton.leftFloatArea} /> @@ -56,19 +71,13 @@ export class Workbench extends Component<{ <div className="lc-workspace-workbench-center-content"> <SubTopArea area={skeleton.subTopArea} itemClassName={topAreaItemClassName} /> <div className="lc-workspace-workbench-window"> - { - workspace.windows.map(d => ( - <WindowView - active={d.id === workspace.window?.id} - window={d} - key={d.id} - /> - )) - } + {workspace.windows.map((d) => ( + <WindowView active={d.id === workspace.window?.id} window={d} key={d.id} /> + ))} - { - !workspace.windows.length && WorkspaceEmptyComponent ? <WorkspaceEmptyComponent /> : null - } + {!workspace.windows.length && WorkspaceEmptyComponent ? ( + <WorkspaceEmptyComponent /> + ) : null} </div> </div> <MainArea area={skeleton.mainArea} /> diff --git a/packages/workspace/src/resource-type.ts b/packages/workspace/src/resource-type.ts index 28d54e56b3..6288627d13 100644 --- a/packages/workspace/src/resource-type.ts +++ b/packages/workspace/src/resource-type.ts @@ -1,6 +1,7 @@ -import { IPublicTypeResourceType } from '@alilc/lowcode-types'; +import { IPublicTypeResourceType } from '@felce/lowcode-types'; -export interface IResourceType extends Omit<IPublicTypeResourceType, 'resourceName' | 'resourceType'> { +export interface IResourceType + extends Omit<IPublicTypeResourceType, 'resourceName' | 'resourceType'> { name: string; type: 'editor' | 'webview'; @@ -9,8 +10,7 @@ export interface IResourceType extends Omit<IPublicTypeResourceType, 'resourceNa } export class ResourceType implements IResourceType { - constructor(readonly resourceTypeModel: IPublicTypeResourceType) { - } + constructor(readonly resourceTypeModel: IPublicTypeResourceType) {} get name() { return this.resourceTypeModel.resourceName; @@ -19,4 +19,4 @@ export class ResourceType implements IResourceType { get type() { return this.resourceTypeModel.resourceType; } -} \ No newline at end of file +} diff --git a/packages/workspace/src/resource.ts b/packages/workspace/src/resource.ts index 6e85183853..cc2d6937e9 100644 --- a/packages/workspace/src/resource.ts +++ b/packages/workspace/src/resource.ts @@ -1,6 +1,12 @@ -import { ISkeleton } from '@alilc/lowcode-editor-skeleton'; -import { IPublicTypeEditorView, IPublicResourceData, IPublicResourceTypeConfig, IBaseModelResource, IPublicEnumPluginRegisterLevel } from '@alilc/lowcode-types'; -import { Logger } from '@alilc/lowcode-utils'; +import { ISkeleton } from '@felce/lowcode-editor-skeleton'; +import { + IPublicTypeEditorView, + IPublicResourceData, + IPublicResourceTypeConfig, + IBaseModelResource, + IPublicEnumPluginRegisterLevel, +} from '@felce/lowcode-types'; +import { Logger } from '@felce/lowcode-utils'; import { BasicContext, IBasicContext } from './context/base-context'; import { ResourceType, IResourceType } from './resource-type'; import { IWorkspace } from './workspace'; @@ -41,7 +47,9 @@ export class Resource implements IResource { } get viewName() { - return this.resourceData.viewName || (this.resourceData as any).viewType || this.defaultViewName; + return ( + this.resourceData.viewName || (this.resourceData as any).viewType || this.defaultViewName + ); } get description() { @@ -82,11 +90,22 @@ export class Resource implements IResource { return this.resourceData.config; } - constructor(readonly resourceData: IPublicResourceData, readonly resourceType: IResourceType, readonly workspace: IWorkspace) { - this.context = new BasicContext(workspace, `resource-${resourceData.resourceName || resourceType.name}`, IPublicEnumPluginRegisterLevel.Resource); - this.resourceTypeInstance = resourceType.resourceTypeModel(this.context.innerPlugins._getLowCodePluginContext({ - pluginName: '', - }), this.options); + constructor( + readonly resourceData: IPublicResourceData, + readonly resourceType: IResourceType, + readonly workspace: IWorkspace, + ) { + this.context = new BasicContext( + workspace, + `resource-${resourceData.resourceName || resourceType.name}`, + IPublicEnumPluginRegisterLevel.Resource, + ); + this.resourceTypeInstance = resourceType.resourceTypeModel( + this.context.innerPlugins._getLowCodePluginContext({ + pluginName: '', + }), + this.options, + ); this.init(); if (this.resourceTypeInstance.editorViews) { this.resourceTypeInstance.editorViews.forEach((d: any) => { @@ -96,7 +115,15 @@ export class Resource implements IResource { if (!resourceType) { logger.error(`resourceType[${resourceType}] is unValid.`); } - this.children = this.resourceData?.children?.map(d => new Resource(d, this.workspace.getResourceType(d.resourceName || this.resourceType.name), this.workspace)) || []; + this.children = + this.resourceData?.children?.map( + (d) => + new Resource( + d, + this.workspace.getResourceType(d.resourceName || this.resourceType.name), + this.workspace, + ), + ) || []; } async init() { @@ -127,4 +154,4 @@ export class Resource implements IResource { getEditorView(name: string) { return this.editorViewMap.get(name); } -} \ No newline at end of file +} diff --git a/packages/workspace/src/view/editor-view.tsx b/packages/workspace/src/view/editor-view.tsx index 7ada5c911e..c421832816 100644 --- a/packages/workspace/src/view/editor-view.tsx +++ b/packages/workspace/src/view/editor-view.tsx @@ -1,18 +1,19 @@ -import { BuiltinLoading } from '@alilc/lowcode-designer'; -import { engineConfig, observer } from '@alilc/lowcode-editor-core'; -import { - Workbench, -} from '@alilc/lowcode-editor-skeleton'; +import { BuiltinLoading } from '@felce/lowcode-designer'; +import { engineConfig, observer } from '@felce/lowcode-editor-core'; +import { Workbench } from '@felce/lowcode-editor-skeleton'; import { PureComponent } from 'react'; import { Context } from '../context/view-context'; export * from '../context/base-context'; @observer -export class EditorView extends PureComponent<{ - editorView: Context; - active: boolean; -}, any> { +export class EditorView extends PureComponent< + { + editorView: Context; + active: boolean; + }, + any +> { render() { const { active } = this.props; const editorView = this.props.editorView; diff --git a/packages/workspace/src/view/resource-view.tsx b/packages/workspace/src/view/resource-view.tsx index e2204dd505..59a117e571 100644 --- a/packages/workspace/src/view/resource-view.tsx +++ b/packages/workspace/src/view/resource-view.tsx @@ -1,16 +1,19 @@ import { PureComponent } from 'react'; import { EditorView } from './editor-view'; -import { observer } from '@alilc/lowcode-editor-core'; +import { observer } from '@felce/lowcode-editor-core'; import { IResource } from '../resource'; import { IEditorWindow } from '../window'; import './resource-view.less'; -import { TopArea } from '@alilc/lowcode-editor-skeleton'; +import { TopArea } from '@felce/lowcode-editor-skeleton'; @observer -export class ResourceView extends PureComponent<{ - window: IEditorWindow; - resource: IResource; -}, any> { +export class ResourceView extends PureComponent< + { + window: IEditorWindow; + resource: IResource; + }, + any +> { render() { const { skeleton } = this.props.resource; const { editorViews } = this.props.window; @@ -18,19 +21,17 @@ export class ResourceView extends PureComponent<{ <div className="workspace-resource-view"> <TopArea area={skeleton.topArea} itemClassName="engine-actionitem" /> <div className="workspace-editor-body"> - { - Array.from(editorViews.values()).map((editorView: any) => { - return ( - <EditorView - key={editorView.name} - active={editorView.active} - editorView={editorView} - /> - ); - }) - } + {Array.from(editorViews.values()).map((editorView: any) => { + return ( + <EditorView + key={editorView.name} + active={editorView.active} + editorView={editorView} + /> + ); + })} </div> </div> ); } -} \ No newline at end of file +} diff --git a/packages/workspace/src/view/window-view.tsx b/packages/workspace/src/view/window-view.tsx index 65378bc9c4..a0cd358d53 100644 --- a/packages/workspace/src/view/window-view.tsx +++ b/packages/workspace/src/view/window-view.tsx @@ -1,15 +1,18 @@ import { PureComponent } from 'react'; import { ResourceView } from './resource-view'; -import { engineConfig, observer } from '@alilc/lowcode-editor-core'; +import { engineConfig, observer } from '@felce/lowcode-editor-core'; import { EditorWindow } from '../window'; -import { BuiltinLoading } from '@alilc/lowcode-designer'; +import { BuiltinLoading } from '@felce/lowcode-designer'; import { DesignerView } from '../inner-plugins/webview'; @observer -export class WindowView extends PureComponent<{ - window: EditorWindow; - active: boolean; -}, any> { +export class WindowView extends PureComponent< + { + window: EditorWindow; + active: boolean; + }, + any +> { render() { const { active } = this.props; const { resource, initReady, url } = this.props.window; @@ -29,11 +32,8 @@ export class WindowView extends PureComponent<{ return ( <div className={`workspace-engine-main ${active ? 'active' : ''}`}> - <ResourceView - resource={resource} - window={this.props.window} - /> + <ResourceView resource={resource} window={this.props.window} /> </div> ); } -} \ No newline at end of file +} diff --git a/packages/workspace/src/window.ts b/packages/workspace/src/window.ts index cd64a9b112..d8e2da3429 100644 --- a/packages/workspace/src/window.ts +++ b/packages/workspace/src/window.ts @@ -1,9 +1,9 @@ -import { uniqueId } from '@alilc/lowcode-utils'; -import { createModuleEventBus, IEventBus, makeObservable, obx } from '@alilc/lowcode-editor-core'; +import { uniqueId } from '@felce/lowcode-utils'; +import { createModuleEventBus, IEventBus, makeObservable, obx } from '@felce/lowcode-editor-core'; import { Context, IViewContext } from './context/view-context'; import { IWorkspace } from './workspace'; import { IResource } from './resource'; -import { IPublicModelWindow, IPublicTypeDisposable } from '@alilc/lowcode-types'; +import { IPublicModelWindow, IPublicTypeDisposable } from '@felce/lowcode-types'; interface IWindowCOnfig { title: string | undefined; @@ -12,7 +12,11 @@ interface IWindowCOnfig { sleep?: boolean; } -export interface IEditorWindow extends Omit<IPublicModelWindow<IResource>, 'changeViewType' | 'currentEditorView' | 'editorViews'> { +export interface IEditorWindow + extends Omit< + IPublicModelWindow<IResource>, + 'changeViewType' | 'currentEditorView' | 'editorViews' + > { readonly resource: IResource; editorViews: Map<string, IViewContext>; @@ -41,7 +45,7 @@ export enum WINDOW_STATE { inactive = 'inactive', // 销毁 - destroyed = 'destroyed' + destroyed = 'destroyed', } export class EditorWindow implements IEditorWindow { @@ -69,7 +73,11 @@ export class EditorWindow implements IEditorWindow { return this._editorView; } - constructor(readonly resource: IResource, readonly workspace: IWorkspace, private config: IWindowCOnfig) { + constructor( + readonly resource: IResource, + readonly workspace: IWorkspace, + private config: IWindowCOnfig, + ) { makeObservable(this); this.title = config.title; this.icon = resource.icon; @@ -99,7 +107,7 @@ export class EditorWindow implements IEditorWindow { return; } - Object.keys(newSchema).forEach(key => { + Object.keys(newSchema).forEach((key) => { const view = this.editorViews.get(key); view?.project.importSchema(newSchema[key]); }); @@ -133,10 +141,11 @@ export class EditorWindow implements IEditorWindow { async init() { await this.initViewTypes(); await this.execViewTypesInit(); - Promise.all(Array.from(this.editorViews.values()).map((d) => d.onSimulatorRendererReady())) - .then(() => { - this.workspace.emitWindowRendererReady(); - }); + Promise.all( + Array.from(this.editorViews.values()).map((d) => d.onSimulatorRendererReady()), + ).then(() => { + this.workspace.emitWindowRendererReady(); + }); this.url = await this.resource.url(); this.setDefaultViewName(); this.initReady = true; @@ -250,4 +259,4 @@ export class EditorWindow implements IEditorWindow { get innerPlugins() { return this.editorView?.innerPlugins; } -} \ No newline at end of file +} diff --git a/packages/workspace/src/workspace.ts b/packages/workspace/src/workspace.ts index 9f1abaa0fb..f229cbab67 100644 --- a/packages/workspace/src/workspace.ts +++ b/packages/workspace/src/workspace.ts @@ -1,12 +1,27 @@ -import { IDesigner, ILowCodePluginManager, LowCodePluginManager } from '@alilc/lowcode-designer'; -import { createModuleEventBus, Editor, IEditor, IEventBus, makeObservable, obx } from '@alilc/lowcode-editor-core'; -import { IPublicApiPlugins, IPublicApiWorkspace, IPublicEnumPluginRegisterLevel, IPublicResourceList, IPublicTypeDisposable, IPublicTypeResourceType, IShellModelFactory } from '@alilc/lowcode-types'; +import { IDesigner, ILowCodePluginManager, LowCodePluginManager } from '@felce/lowcode-designer'; +import { + createModuleEventBus, + Editor, + IEditor, + IEventBus, + makeObservable, + obx, +} from '@felce/lowcode-editor-core'; +import { + IPublicApiPlugins, + IPublicApiWorkspace, + IPublicEnumPluginRegisterLevel, + IPublicResourceList, + IPublicTypeDisposable, + IPublicTypeResourceType, + IShellModelFactory, +} from '@felce/lowcode-types'; import { BasicContext } from './context/base-context'; import { EditorWindow, WINDOW_STATE } from './window'; import type { IEditorWindow } from './window'; import { IResource, Resource } from './resource'; import { IResourceType, ResourceType } from './resource-type'; -import { ISkeleton } from '@alilc/lowcode-editor-skeleton'; +import { ISkeleton } from '@felce/lowcode-editor-skeleton'; enum EVENT { CHANGE_WINDOW = 'change_window', @@ -20,11 +35,16 @@ enum EVENT { const CHANGE_EVENT = 'resource.list.change'; -export interface IWorkspace extends Omit<IPublicApiWorkspace< - LowCodePluginManager, - IEditorWindow ->, 'resourceList' | 'plugins' | 'openEditorWindow' | 'removeEditorWindow'> { - readonly registryInnerPlugin: (designer: IDesigner, editor: Editor, plugins: IPublicApiPlugins) => Promise<IPublicTypeDisposable>; +export interface IWorkspace + extends Omit< + IPublicApiWorkspace<LowCodePluginManager, IEditorWindow>, + 'resourceList' | 'plugins' | 'openEditorWindow' | 'removeEditorWindow' + > { + readonly registryInnerPlugin: ( + designer: IDesigner, + editor: Editor, + plugins: IPublicApiPlugins, + ) => Promise<IPublicTypeDisposable>; readonly shellModelFactory: IShellModelFactory; @@ -66,7 +86,13 @@ export interface IWorkspace extends Omit<IPublicApiWorkspace< /** * @deprecated */ - openEditorWindow(name: string, title: string, options: Object, viewName?: string, sleep?: boolean): Promise<void>; + openEditorWindow( + name: string, + title: string, + options: Object, + viewName?: string, + sleep?: boolean, + ): Promise<void>; } export class Workspace implements IWorkspace { @@ -108,15 +134,22 @@ export class Workspace implements IWorkspace { @obx.ref window: IEditorWindow; - windowQueue: ({ - name: string; - title: string; - options: Object; - viewName?: string; - } | IResource)[] = []; + windowQueue: ( + | { + name: string; + title: string; + options: Object; + viewName?: string; + } + | IResource + )[] = []; constructor( - readonly registryInnerPlugin: (designer: IDesigner, editor: IEditor, plugins: IPublicApiPlugins) => Promise<IPublicTypeDisposable>, + readonly registryInnerPlugin: ( + designer: IDesigner, + editor: IEditor, + plugins: IPublicApiPlugins, + ) => Promise<IPublicTypeDisposable>, readonly shellModelFactory: any, ) { this.context = new BasicContext(this, '', IPublicEnumPluginRegisterLevel.Workspace); @@ -133,7 +166,12 @@ export class Workspace implements IWorkspace { if (windowInfo instanceof Resource) { this.openEditorWindowByResource(windowInfo); } else if (windowInfo) { - this.openEditorWindow(windowInfo.name, windowInfo.title, windowInfo.options, windowInfo.viewName); + this.openEditorWindow( + windowInfo.name, + windowInfo.title, + windowInfo.options, + windowInfo.viewName, + ); } } @@ -142,10 +180,14 @@ export class Workspace implements IWorkspace { return; } const resourceName = this.defaultResourceType.name; - const resource = new Resource({ - resourceName, - options: {}, - }, this.defaultResourceType, this); + const resource = new Resource( + { + resourceName, + options: {}, + }, + this.defaultResourceType, + this, + ); this.window = new EditorWindow(resource, this, { title: resource.title, }); @@ -174,7 +216,9 @@ export class Workspace implements IWorkspace { } setResourceList(resourceList: IPublicResourceList) { - this.resourceList = resourceList.map(d => new Resource(d, this.getResourceType(d.resourceName), this)); + this.resourceList = resourceList.map( + (d) => new Resource(d, this.getResourceType(d.resourceName), this), + ); this.emitter.emit(CHANGE_EVENT, resourceList); } @@ -207,7 +251,7 @@ export class Workspace implements IWorkspace { } removeEditorWindowById(id: string) { - const index = this.windows.findIndex(d => (d.id === id)); + const index = this.windows.findIndex((d) => d.id === id); this.remove(index); } @@ -230,12 +274,14 @@ export class Workspace implements IWorkspace { } removeEditorWindow(resourceName: string, id: string) { - const index = this.windows.findIndex(d => (d.resource?.name === resourceName && (d.title === id || d.resource.id === id))); + const index = this.windows.findIndex( + (d) => d.resource?.name === resourceName && (d.title === id || d.resource.id === id), + ); this.remove(index); } removeEditorWindowByResource(resource: IResource) { - const index = this.windows.findIndex(d => (d.resource?.id === resource.id)); + const index = this.windows.findIndex((d) => d.resource?.id === resource.id); this.remove(index); } @@ -260,7 +306,7 @@ export class Workspace implements IWorkspace { this.window?.updateState(WINDOW_STATE.inactive); - const filterWindows = this.windows.filter(d => (d.resource?.id === resource.id)); + const filterWindows = this.windows.filter((d) => d.resource?.id === resource.id); if (filterWindows && filterWindows.length) { this.window = filterWindows[0]; if (!sleep && this.window.sleep) { @@ -293,10 +339,19 @@ export class Workspace implements IWorkspace { this.window?.updateState(WINDOW_STATE.active); } - async openEditorWindow(name: string, title: string, options: Object, viewName?: string, sleep?: boolean) { + async openEditorWindow( + name: string, + title: string, + options: Object, + viewName?: string, + sleep?: boolean, + ) { if (this.window && !this.window.sleep && !this.window?.initReady && !sleep) { this.windowQueue.push({ - name, title, options, viewName, + name, + title, + options, + viewName, }); return; } @@ -306,7 +361,9 @@ export class Workspace implements IWorkspace { return; } this.window?.updateState(WINDOW_STATE.inactive); - const filterWindows = this.windows.filter(d => (d.resource?.name === name && d.resource.title == title) || (d.resource.id == title)); + const filterWindows = this.windows.filter( + (d) => (d.resource?.name === name && d.resource.title == title) || d.resource.id == title, + ); if (filterWindows && filterWindows.length) { this.window = filterWindows[0]; if (!sleep && this.window.sleep) { @@ -318,12 +375,16 @@ export class Workspace implements IWorkspace { this.window?.updateState(WINDOW_STATE.active); return; } - const resource = new Resource({ - resourceName: name, - title, - options, - id: title?.toString(), - }, resourceType, this); + const resource = new Resource( + { + resourceName: name, + title, + options, + id: title?.toString(), + }, + resourceType, + this, + ); const window = new EditorWindow(resource, this, { title, options, diff --git a/scripts/build.sh b/scripts/build.sh index 751e9094fe..0be5f8871f 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -3,26 +3,26 @@ set -e lerna run build \ - --scope @alilc/lowcode-types \ - --scope @alilc/lowcode-utils \ - --scope @alilc/lowcode-shell \ - --scope @alilc/lowcode-editor-core \ - --scope @alilc/lowcode-editor-skeleton \ - --scope @alilc/lowcode-designer \ - --scope @alilc/lowcode-plugin-designer \ - --scope @alilc/lowcode-plugin-command \ - --scope @alilc/lowcode-plugin-outline-pane \ - --scope @alilc/lowcode-react-renderer \ - --scope @alilc/lowcode-react-simulator-renderer \ - --scope @alilc/lowcode-renderer-core \ - --scope @alilc/lowcode-workspace \ - --scope @alilc/lowcode-engine \ + --scope @felce/lowcode-types \ + --scope @felce/lowcode-utils \ + --scope @felce/lowcode-shell \ + --scope @felce/lowcode-editor-core \ + --scope @felce/lowcode-editor-skeleton \ + --scope @felce/lowcode-designer \ + --scope @felce/lowcode-plugin-designer \ + --scope @felce/lowcode-plugin-command \ + --scope @felce/lowcode-plugin-outline-pane \ + --scope @felce/lowcode-react-renderer \ + --scope @felce/lowcode-react-simulator-renderer \ + --scope @felce/lowcode-renderer-core \ + --scope @felce/lowcode-workspace \ + --scope @felce/lowcode-engine \ --stream lerna run build:umd \ - --scope @alilc/lowcode-engine \ - --scope @alilc/lowcode-react-simulator-renderer \ - --scope @alilc/lowcode-react-renderer \ + --scope @felce/lowcode-engine \ + --scope @felce/lowcode-react-simulator-renderer \ + --scope @felce/lowcode-react-renderer \ --stream cp ./packages/react-simulator-renderer/dist/js/* ./packages/engine/dist/js/ diff --git a/scripts/set-repo.js b/scripts/set-repo.js index 9bae66d053..d856274afb 100644 --- a/scripts/set-repo.js +++ b/scripts/set-repo.js @@ -4,42 +4,42 @@ const path = require('path'); const fs = require('fs-extra'); (async () => { - const root = path.join(__dirname, '../'); - const workspaces = ['modules', 'packages']; - for (const workspace of workspaces) { - const pkgDir = path.join(root, workspace); - const pkgs = await fs.readdir(pkgDir); - for (const pkg of pkgs) { - if (pkg.charAt(0) === '.') continue; - if (!(await fs.statSync(path.join(pkgDir, pkg))).isDirectory()) continue; - await setRepo({ - workspace, - pkgDir, - pkg, - }); - } + const root = path.join(__dirname, '../'); + const workspaces = ['modules', 'packages']; + for (const workspace of workspaces) { + const pkgDir = path.join(root, workspace); + const pkgs = await fs.readdir(pkgDir); + for (const pkg of pkgs) { + if (pkg.charAt(0) === '.') continue; + if (!(await fs.statSync(path.join(pkgDir, pkg))).isDirectory()) continue; + await setRepo({ + workspace, + pkgDir, + pkg, + }); } + } - async function setRepo(opts) { - const pkgDir = path.join(opts.pkgDir, opts.pkg); - const pkgPkgJSONPath = path.join(pkgDir, 'package.json'); - if (!fs.existsSync(pkgPkgJSONPath)) { - console.log(`${opts.pkg} exists`); - } else { - const pkgPkgJSON = require(pkgPkgJSONPath); - fs.writeJSONSync( - pkgPkgJSONPath, - Object.assign(pkgPkgJSON, { - repository: { - type: 'http', - url: `https://github.com/alibaba/lowcode-engine/tree/main/${opts.workspace}/${opts.pkg}`, - }, - bugs: 'https://github.com/alibaba/lowcode-engine/issues', - homepage: 'https://github.com/alibaba/lowcode-engine/#readme', - }), - { spaces: ' ' }, - ); - console.log(`[Write] ${opts.pkg}`); - } + async function setRepo(opts) { + const pkgDir = path.join(opts.pkgDir, opts.pkg); + const pkgPkgJSONPath = path.join(pkgDir, 'package.json'); + if (!fs.existsSync(pkgPkgJSONPath)) { + console.log(`${opts.pkg} exists`); + } else { + const pkgPkgJSON = require(pkgPkgJSONPath); + fs.writeJSONSync( + pkgPkgJSONPath, + Object.assign(pkgPkgJSON, { + repository: { + type: 'http', + url: `https://github.com/fe-lce/lowcode-engine/tree/main/${opts.workspace}/${opts.pkg}`, + }, + bugs: 'https://github.com/fe-lce/lowcode-engine/issues', + homepage: 'https://github.com/fe-lce/lowcode-engine/#readme', + }), + { spaces: ' ' }, + ); + console.log(`[Write] ${opts.pkg}`); } + } })(); diff --git a/scripts/setup-for-test.sh b/scripts/setup-for-test.sh index b0734c362f..e1c990bb43 100755 --- a/scripts/setup-for-test.sh +++ b/scripts/setup-for-test.sh @@ -7,7 +7,7 @@ find ./packages -type f -name "package-lock.json" -exec rm -f {} \; lerna bootstrap lerna exec --stream \ - --scope @alilc/lowcode-editor-core \ - --scope @alilc/lowcode-types \ - --scope @alilc/lowcode-utils \ + --scope @felce/lowcode-editor-core \ + --scope @felce/lowcode-types \ + --scope @felce/lowcode-utils \ -- npm run build diff --git a/scripts/start.js b/scripts/start.js index e1a83ea732..bb954d7cfd 100644 --- a/scripts/start.js +++ b/scripts/start.js @@ -3,8 +3,13 @@ const os = require('os'); const execa = require('execa'); async function start() { - const [, , pkgName = '@alilc/lowcode-ignitor'] = process.argv; - await execa.command(`lerna exec --scope ${pkgName} -- npm start`, { stdio: 'inherit', encoding: 'utf-8' }); + const [, , pkgName = '@felce/lowcode-ignitor'] = process.argv; + await execa.command(`lerna exec --scope ${pkgName} -- npm start`, { + stdio: 'inherit', + encoding: 'utf-8', + }); } -os.type() === 'Windows_NT' ? start() : execa.command('scripts/start.sh', { stdio: 'inherit', encoding: 'utf-8' }); +os.type() === 'Windows_NT' + ? start() + : execa.command('scripts/start.sh', { stdio: 'inherit', encoding: 'utf-8' }); diff --git a/scripts/start.sh b/scripts/start.sh index 88593ebe03..329399271e 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -pkgName="@alilc/lowcode-ignitor" +pkgName="@felce/lowcode-ignitor" if [ "$1" ]; then pkgName="$1" diff --git a/scripts/sync.sh b/scripts/sync.sh index 3edac03845..dfab8991c3 100755 --- a/scripts/sync.sh +++ b/scripts/sync.sh @@ -1,17 +1,17 @@ #!/usr/bin/env bash # sync all packages to alibaba intranet registry -tnpm sync @alilc/lowcode-types -tnpm sync @alilc/lowcode-utils -tnpm sync @alilc/lowcode-shell -tnpm sync @alilc/lowcode-editor-core -tnpm sync @alilc/lowcode-editor-skeleton -tnpm sync @alilc/lowcode-designer -tnpm sync @alilc/lowcode-plugin-designer -tnpm sync @alilc/lowcode-plugin-outline-pane -tnpm sync @alilc/lowcode-renderer-core -tnpm sync @alilc/lowcode-react-renderer -tnpm sync @alilc/lowcode-react-simulator-renderer -tnpm sync @alilc/lowcode-engine -tnpm sync @alilc/lowcode-workspace -tnpm sync @alilc/lowcode-plugin-command \ No newline at end of file +tnpm sync @felce/lowcode-types +tnpm sync @felce/lowcode-utils +tnpm sync @felce/lowcode-shell +tnpm sync @felce/lowcode-editor-core +tnpm sync @felce/lowcode-editor-skeleton +tnpm sync @felce/lowcode-designer +tnpm sync @felce/lowcode-plugin-designer +tnpm sync @felce/lowcode-plugin-outline-pane +tnpm sync @felce/lowcode-renderer-core +tnpm sync @felce/lowcode-react-renderer +tnpm sync @felce/lowcode-react-simulator-renderer +tnpm sync @felce/lowcode-engine +tnpm sync @felce/lowcode-workspace +tnpm sync @felce/lowcode-plugin-command \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index a063661419..a9438e0c3d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -33,7 +33,7 @@ "baseUrl": "./packages", "useDefineForClassFields": true, "paths": { - "@alilc/lowcode-*": ["./*/src"] + "@felce/lowcode-*": ["./*/src"] }, "outDir": "lib" },