diff --git a/.github/auto-labeler.yml b/.github/auto-labeler.yml deleted file mode 100644 index 9727d7434..000000000 --- a/.github/auto-labeler.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: v1 - -labels: - - label: 'enhancement' - sync: true - matcher: - title: '^feat:.*' - - label: 'document' - sync: true - matcher: - title: '^docs:.*' - - label: 'bug' - sync: true - matcher: - title: '^fix:.*' - - label: 'ospp-2024' - sync: true - matcher: - baseBranch: '^ospp-2024/.*' - - label: 'refactor-main' - sync: true - matcher: - baseBranch: 'refactor/develop' diff --git a/.github/workflows/auto-labeler.yml b/.github/workflows/auto-labeler.yml deleted file mode 100644 index f607334c5..000000000 --- a/.github/workflows/auto-labeler.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Pull Request Auto Labeler - -on: - pull_request_target: - types: [opened, edited] - -permissions: - # Setting up permissions in the workflow to limit the scope of what it can do. Optional! - contents: read # the config file - pull-requests: write # for labeling pull requests (on: pull_request_target or on: pull_request) - -jobs: - label: - runs-on: ubuntu-latest - steps: - - uses: fuxingloh/multi-labeler@v4 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} # optional, default to '${{ github.token }}' - config-path: .github/auto-labeler.yml # optional, default to '.github/labeler.yml' diff --git a/.github/workflows/push-check.yml b/.github/workflows/push-check.yml index e115a003c..2fc96cc8c 100644 --- a/.github/workflows/push-check.yml +++ b/.github/workflows/push-check.yml @@ -4,7 +4,7 @@ on: push: branches: [] pull_request: - branches: [develop,main,ospp-2024/*] + branches: [develop,main] jobs: push-check: diff --git a/README.md b/README.md index 37515208c..57af470d1 100644 --- a/README.md +++ b/README.md @@ -88,9 +88,9 @@ gantt dateFormat YYYY-MM-DD axisFormat %Y-%m-%d -1.0.0-beta.x version : 2023-09-25, 2024-05-20 -1.0.0-rc version(refactor version) : 2024-10-01 -1.0.0 version : 2024-11-01 + 1.0.0-beta.x version :active,2023-09-25, 2024-03-31 + 1.0.0-rc version : 2024-04-01, 2024-06-30 + 1.0.0 version : 2024-07-01, 2024-07-31 ``` diff --git a/README.zh-CN.md b/README.zh-CN.md index 636ad668c..fd1a0259a 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -37,17 +37,16 @@ $ pnpm install $ pnpm dev ``` -### 本地开发,直连本地的tiny-engine-webservice服务端 +### 本地开发,直连本地的 tiny-engine-webservice 服务端 1. 启动 tiny-engine-data-center 2. 启动 tiny-engine-webservice -3. 修改 tiny-engine 项目 `packages/design-core/` 目录下 `vite.config.js` 中origin的值为自己本地webService项目的地址端口(webService端口默认为7011),如: +3. 修改 tiny-engine 项目 `packages/design-core/` 目录下 `vite.config.js` 中 origin 的值为自己本地 webService 项目的地址端口(webService 端口默认为 7011),如: 修改端口 - ### 物料同步[方案](https://opentiny.design/tiny-engine#/help-center/course/engine/56) ```sh @@ -76,7 +75,9 @@ pnpm run build:plugin pnpm run build:alpha 或 build:prod ``` + 构建后产物所在文件夹 + ``` tiny-engine/packages/design-core/dist/ ``` @@ -84,13 +85,13 @@ pnpm run build:alpha 或 build:prod ## 里程碑 ```mermaid -gantt +gantt dateFormat YYYY-MM-DD axisFormat %Y-%m-%d -1.0.0-beta.x version : 2023-09-25, 2024-05-20 -1.0.0-rc version(refactor version) : 2024-10-01 -1.0.0 version : 2024-11-01 + 1.0.0-beta.x version :active,2023-09-25, 2024-03-31 + 1.0.0-rc version : 2024-04-01, 2024-06-30 + 1.0.0 version : 2024-07-01, 2024-07-31 ``` diff --git a/mockServer/package.json b/mockServer/package.json index a922e3710..7904195dc 100644 --- a/mockServer/package.json +++ b/mockServer/package.json @@ -1,6 +1,6 @@ { "name": "@opentiny/tiny-engine-mock", - "version": "1.0.6", + "version": "1.0.3", "publishConfig": { "access": "public" }, @@ -26,7 +26,7 @@ }, "dependencies": { "@opentiny/tiny-engine-dsl-react": "workspace:*", - "@opentiny/tiny-engine-dsl-vue": "^1.0.6", + "@opentiny/tiny-engine-dsl-vue": "workspace:*", "@seald-io/nedb": "^4.0.2", "fs-extra": "^11.1.1", "glob": "^10.3.4", @@ -67,4 +67,4 @@ "node": ">= 7.8.0", "npm": ">= 4.2.0" } -} +} \ No newline at end of file diff --git a/mockServer/src/database/pages.db b/mockServer/src/database/pages.db index 5845e6988..ca4511130 100644 --- a/mockServer/src/database/pages.db +++ b/mockServer/src/database/pages.db @@ -1,11 +1,4 @@ -{"name":"DemoPage","id":"5bhD7p5FUsUOTFRN","app":"918","route":"demopage","page_content":{"state":{},"methods":{},"componentName":"Page","css":"","props":{},"lifeCycles":{},"children":[{"componentName":"div","props":{},"id":"85375559","children":[{"componentName":"TinySwitch","props":{"modelValue":""},"id":"33433546"}]},{"componentName":"AntdButton","props":{},"children":[{"componentName":"Text","props":{"text":"按钮文本"},"id":"25ef8133"}],"id":"233c3f68"},{"componentName":"AntdCheckbox","props":{"text":"复选框文案","className":"name"},"id":"c5266521"}],"dataSource":{"list":[]},"utils":[],"bridge":[],"inputs":[],"outputs":[],"fileName":"DemoPage"},"tenant":1,"isBody":false,"parentId":"0","group":"staticPages","depth":0,"isPage":true,"isDefault":false,"occupier":{"id":86,"username":"开发者","email":"developer@lowcode.com","resetPasswordToken":"developer","confirmationToken":"dfb2c162-351f-4f44-ad5f-8998","is_admin":true},"isHome":false,"message":"Page auto save","_id":"5bhD7p5FUsUOTFRN"} -{"name":"createVm","id":"NTJ4MjvqoVj8OVsc","app":"918","route":"createVm","page_content":{"state":{"dataDisk":[1,2,3]},"methods":{},"componentName":"Page","css":"body {\r\n background-color:#eef0f5 ;\r\n margin-bottom: 80px;\r\n}","props":{},"children":[{"componentName":"div","props":{"style":"padding-bottom: 10px; padding-top: 10px;"},"id":"2b2cabf0","children":[{"componentName":"TinyTimeLine","props":{"active":"2","data":[{"name":"基础配置"},{"name":"网络配置"},{"name":"高级配置"},{"name":"确认配置"}],"horizontal":true,"style":"border-radius: 0px;"},"id":"dd764b17"}]},{"componentName":"div","props":{"style":"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;"},"id":"30c94cc8","children":[{"componentName":"TinyForm","props":{"labelWidth":"80px","labelPosition":"top","inline":false,"label-position":"left ","label-width":"150px","style":"border-radius: 0px;"},"children":[{"componentName":"TinyFormItem","props":{"label":"计费模式"},"children":[{"componentName":"TinyButtonGroup","props":{"data":[{"text":"包年/包月","value":"1"},{"text":"按需计费","value":"2"}],"modelValue":"1"},"id":"a8d84361"}],"id":"9f39f3e7"},{"componentName":"TinyFormItem","props":{"label":"区域"},"children":[{"componentName":"TinyButtonGroup","props":{"data":[{"text":"乌兰察布二零一","value":"1"}],"modelValue":"1","style":"border-radius: 0px; margin-right: 10px;"},"id":"c97ccd99"},{"componentName":"Text","props":{"text":"温馨提示:页面左上角切换区域","style":"background-color: [object Event]; color: #8a8e99; font-size: 12px;"},"id":"20923497"},{"componentName":"Text","props":{"text":"不同区域的云服务产品之间内网互不相通;请就近选择靠近您业务的区域,可减少网络时延,提高访问速度","style":"display: block; color: #8a8e99; border-radius: 0px; font-size: 12px;"},"id":"54780a26"}],"id":"4966384d"},{"componentName":"TinyFormItem","props":{"label":"可用区","style":"border-radius: 0px;"},"children":[{"componentName":"TinyButtonGroup","props":{"data":[{"text":"可用区1","value":"1"},{"text":"可用区2","value":"2"},{"text":"可用区3","value":"3"}],"modelValue":"1"},"id":"6184481b"}],"id":"690837bf"}],"id":"b6a425d4"}]},{"componentName":"div","props":{"style":"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;"},"children":[{"componentName":"TinyForm","props":{"labelWidth":"80px","labelPosition":"top","inline":false,"label-position":"left ","label-width":"150px","style":"border-radius: 0px;"},"children":[{"componentName":"TinyFormItem","props":{"label":"CPU架构"},"children":[{"componentName":"TinyButtonGroup","props":{"data":[{"text":"x86计算","value":"1"},{"text":"鲲鹏计算","value":"2"}],"modelValue":"1"},"id":"7d33ced7"}],"id":"05ed5a79"},{"componentName":"TinyFormItem","props":{"label":"区域"},"children":[{"componentName":"div","props":{"style":"display: flex; justify-content: flex-start; align-items: center;"},"id":"606edf78","children":[{"componentName":"div","props":{"style":"display: flex; align-items: center; margin-right: 10px;"},"id":"f3f98246","children":[{"componentName":"Text","props":{"text":"vCPUs","style":"width: 80px;"},"id":"c287437e"},{"componentName":"TinySelect","props":{"modelValue":"","placeholder":"请选择","options":[{"value":"1","label":"黄金糕"},{"value":"2","label":"双皮奶"}]},"id":"4c43286b"}]},{"componentName":"div","props":{"style":"display: flex; align-items: center; margin-right: 10px;"},"children":[{"componentName":"Text","props":{"text":"内存","style":"width: 80px; border-radius: 0px;"},"id":"38b8fa1f"},{"componentName":"TinySelect","props":{"modelValue":"","placeholder":"请选择","options":[{"value":"1","label":"黄金糕"},{"value":"2","label":"双皮奶"}]},"id":"cd33328e"}],"id":"2b2c678f"},{"componentName":"div","props":{"style":"display: flex; align-items: center;"},"children":[{"componentName":"Text","props":{"text":"规格名称","style":"width: 80px;"},"id":"d3eb6352"},{"componentName":"TinySearch","props":{"modelValue":"","placeholder":"输入关键词"},"id":"21cb9282"}],"id":"b8e0f35c"}]},{"componentName":"div","props":{"style":"border-radius: 0px;"},"id":"5000c83e","children":[{"componentName":"TinyButtonGroup","props":{"data":[{"text":"通用计算型","value":"1"},{"text":"通用计算增强型","value":"2"},{"text":"内存优化型","value":"3"},{"text":"内存优化型","value":"4"},{"text":"磁盘增强型","value":"5"},{"text":"超高I/O型","value":"6"},{"text":"GPU加速型","value":"7"}],"modelValue":"1","style":"border-radius: 0px; margin-top: 12px;"},"id":"b8724703"},{"componentName":"TinyGrid","props":{"editConfig":{"trigger":"click","mode":"cell","showStatus":true},"columns":[{"type":"radio","width":60},{"field":"employees","title":"规格名称"},{"field":"created_date","title":"vCPUs | 内存(GiB)","sortable":true},{"field":"city","title":"CPU","sortable":true},{"title":"基准 / 最大带宽\t","sortable":true},{"title":"内网收发包","sortable":true}],"data":[{"id":"1","name":"GFD科技有限公司","city":"福州","employees":800,"created_date":"2014-04-30 00:56:00","boole":false},{"id":"2","name":"WWW科技有限公司","city":"深圳","employees":300,"created_date":"2016-07-08 12:36:22","boole":true}],"style":"margin-top: 12px; border-radius: 0px;","auto-resize":true},"id":"77701c25"},{"componentName":"div","props":{"style":"margin-top: 12px; border-radius: 0px;"},"id":"3339838b","children":[{"componentName":"Text","props":{"text":"当前规格","style":"width: 150px; display: inline-block;"},"id":"203b012b"},{"componentName":"Text","props":{"text":"通用计算型 | Si2.large.2 | 2vCPUs | 4 GiB","style":"font-weight: 700;"},"id":"87723f52"}]}]}],"id":"657fb2fc"}],"id":"d19b15cf"}],"id":"9991228b"},{"componentName":"div","props":{"style":"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;"},"children":[{"componentName":"TinyForm","props":{"labelWidth":"80px","labelPosition":"top","inline":false,"label-position":"left ","label-width":"150px","style":"border-radius: 0px;"},"children":[{"componentName":"TinyFormItem","props":{"label":"镜像","style":"border-radius: 0px;"},"children":[{"componentName":"TinyButtonGroup","props":{"data":[{"text":"公共镜像","value":"1"},{"text":"私有镜像","value":"2"},{"text":"共享镜像","value":"3"}],"modelValue":"1"},"id":"922b14cb"},{"componentName":"div","props":{"style":"display: flex; margin-top: 12px; border-radius: 0px;"},"id":"6b679524","children":[{"componentName":"TinySelect","props":{"modelValue":"","placeholder":"请选择","options":[{"value":"1","label":"黄金糕"},{"value":"2","label":"双皮奶"}],"style":"width: 170px; margin-right: 10px;"},"id":"4851fff7"},{"componentName":"TinySelect","props":{"modelValue":"","placeholder":"请选择","options":[{"value":"1","label":"黄金糕"},{"value":"2","label":"双皮奶"}],"style":"width: 340px;"},"id":"a7183eb7"}]},{"componentName":"div","props":{"style":"margin-top: 12px;"},"id":"57aee314","children":[{"componentName":"Text","props":{"text":"请注意操作系统的语言类型。","style":"color: #e37d29;"},"id":"56d36c27"}]}],"id":"e3b02436"}],"id":"59aebf2b"}],"id":"87ff7b99"},{"componentName":"div","props":{"style":"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;"},"children":[{"componentName":"TinyForm","props":{"labelWidth":"80px","labelPosition":"top","inline":false,"label-position":"left ","label-width":"150px","style":"border-radius: 0px;"},"children":[{"componentName":"TinyFormItem","props":{"label":"系统盘","style":"border-radius: 0px;"},"children":[{"componentName":"div","props":{"style":"display: flex;"},"id":"cddba5b8","children":[{"componentName":"TinySelect","props":{"modelValue":"","placeholder":"请选择","options":[{"value":"1","label":"黄金糕"},{"value":"2","label":"双皮奶"}],"style":"width: 200px; margin-right: 10px;"},"id":"a97fbe15"},{"componentName":"TinyInput","props":{"placeholder":"请输入","modelValue":"","style":"width: 120px; margin-right: 10px;"},"id":"1cde4c0f"},{"componentName":"Text","props":{"text":"GiB \nIOPS上限240,IOPS突发上限5,000","style":"color: #575d6c; font-size: 12px;"},"id":"2815d82d"}]}],"id":"50239a3a"}],"id":"e8582986"},{"componentName":"TinyForm","props":{"labelWidth":"80px","labelPosition":"top","inline":false,"label-position":"left ","label-width":"150px","style":"border-radius: 0px;"},"children":[{"componentName":"TinyFormItem","props":{"label":"数据盘","style":"border-radius: 0px;"},"children":[{"componentName":"div","props":{"style":"margin-top: 12px; display: flex;"},"id":"728c9825","children":[{"componentName":"Icon","props":{"style":"margin-right: 10px; width: 16px; height: 16px;","name":"IconPanelMini"},"id":"fded6930"},{"componentName":"TinySelect","props":{"modelValue":"","placeholder":"请选择","options":[{"value":"1","label":"黄金糕"},{"value":"2","label":"双皮奶"}],"style":"width: 200px; margin-right: 10px;"},"id":"62734e3f"},{"componentName":"TinyInput","props":{"placeholder":"请输入","modelValue":"","style":"width: 120px; margin-right: 10px;"},"id":"667c7926"},{"componentName":"Text","props":{"text":"GiB \nIOPS上限600,IOPS突发上限5,000","style":"color: #575d6c; font-size: 12px; margin-right: 10px;"},"id":"e7bc36d6"},{"componentName":"TinyInput","props":{"placeholder":"请输入","modelValue":"","style":"width: 120px;"},"id":"1bd56dc0"}],"loop":{"type":"JSExpression","value":"this.state.dataDisk"}},{"componentName":"div","props":{"style":"display: flex; margin-top: 12px; border-radius: 0px;"},"children":[{"componentName":"Icon","props":{"name":"IconPlus","style":"width: 16px; height: 16px; margin-right: 10px;"},"id":"65c89f2b"},{"componentName":"Text","props":{"text":"增加一块数据盘","style":"font-size: 12px; border-radius: 0px; margin-right: 10px;"},"id":"cb344071"},{"componentName":"Text","props":{"text":"您还可以挂载 21 块磁盘(云硬盘)","style":"color: #8a8e99; font-size: 12px;"},"id":"80eea996"}],"id":"e9e530ab"}],"id":"078e03ef"}],"id":"ccef886e"}],"id":"0fb7bd74"},{"componentName":"div","props":{"style":"border-width: 1px; border-style: solid; border-color: #ffffff; padding-top: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; position: fixed; inset: auto 0% 0% 0%; height: 80px; line-height: 80px; border-radius: 0px;"},"children":[{"componentName":"TinyForm","props":{"labelWidth":"80px","labelPosition":"top","inline":false,"label-position":"left ","label-width":"150px","style":"border-radius: 0px;"},"children":[],"id":"21ed4475"},{"componentName":"TinyRow","props":{"style":"border-radius: 0px; height: 100%;"},"children":[{"componentName":"TinyCol","props":{"span":"8"},"id":"b9d051a5","children":[{"componentName":"TinyRow","props":{"style":"border-radius: 0px;"},"children":[{"componentName":"TinyCol","props":{"span":"5","style":"display: flex;"},"id":"02352776","children":[{"componentName":"Text","props":{"text":"购买量","style":"margin-right: 10px;"},"id":"0cd9ed5c"},{"componentName":"TinyInput","props":{"placeholder":"请输入","modelValue":"","style":"width: 120px; margin-right: 10px;"},"id":"2f9cf442"},{"componentName":"Text","props":{"text":"台"},"id":"facd4481"}]},{"componentName":"TinyCol","props":{"span":"7"},"id":"82b6c659","children":[{"componentName":"div","props":{},"id":"9cd65874","children":[{"componentName":"Text","props":{"text":"配置费用","style":"font-size: 12px;"},"id":"b5a0a0da"},{"componentName":"Text","props":{"text":"¥1.5776","style":"padding-left: 10px; padding-right: 10px; color: #de504e;"},"id":"d9464214"},{"componentName":"Text","props":{"text":"/小时","style":"font-size: 12px;"},"id":"af7cc5e6"}]},{"componentName":"div","props":{},"id":"89063830","children":[{"componentName":"Text","props":{"text":"参考价格,具体扣费请以账单为准。","style":"font-size: 12px; border-radius: 0px;"},"id":"d8995fbc"},{"componentName":"Text","props":{"text":"了解计费详情","style":"font-size: 12px; color: #344899;"},"id":"b383c3e2"}]}]}],"id":"94fc0e43"}]},{"componentName":"TinyCol","props":{"span":"4","style":"display: flex; flex-direction: row-reverse; border-radius: 0px; height: 100%; justify-content: flex-start; align-items: center;"},"id":"10b73009","children":[{"componentName":"TinyButton","props":{"text":"下一步: 网络配置","type":"danger","style":"max-width: unset;"},"id":"0b584011"}]}],"id":"d414a473"}],"id":"e8ec029b"}],"fileName":"createVm"},"tenant":1,"isBody":false,"parentId":"0","group":"staticPages","depth":0,"isPage":true,"isDefault":false,"occupier":{"id":86,"username":"开发者","email":"developer@lowcode.com","resetPasswordToken":"developer","confirmationToken":"dfb2c162-351f-4f44-ad5f-8998","is_admin":true},"isHome":false,"_id":"NTJ4MjvqoVj8OVsc"} +{"name":"DemoPage","id":"5bhD7p5FUsUOTFRN","app":"918","route":"demopage","page_content":{"state":{},"methods":{},"componentName":"Page","css":"","props":{},"lifeCycles":{},"children":[{"componentName":"div","props":{},"id":"85375559","children":[{"componentName":"TinySwitch","props":{"modelValue":""},"id":"33433546"}]},{"componentName":"AntdRadio","props":{"autoFocus":false,"disabled":false,"defaultChecked":false},"children":[{"componentName":"Text","props":{"text":"单选框Label"},"id":"64425466"}],"id":"766345ce"},{"componentName":"AntdRadioButton","props":{"defaultChecked":true,"checked":false},"children":[{"componentName":"Text","props":{"text":"单选框Label"},"id":"a46d1659"}],"id":"31432525"},{"componentName":"AntdRadioButton","props":{"checked":false,"defaultChecked":true},"children":[{"componentName":"Text","props":{"text":"单选框Label"},"id":"65215462"}],"id":"53342943"}],"dataSource":{"list":[]},"utils":[],"bridge":[],"inputs":[],"outputs":[],"fileName":"DemoPage"},"tenant":1,"isBody":false,"parentId":"0","group":"staticPages","depth":0,"isPage":true,"isDefault":false,"occupier":{"id":86,"username":"开发者","email":"developer@lowcode.com","resetPasswordToken":"developer","confirmationToken":"dfb2c162-351f-4f44-ad5f-8998","is_admin":true},"isHome":false,"message":"Page auto save","_id":"5bhD7p5FUsUOTFRN"} +{"name":"createVm","id":"NTJ4MjvqoVj8OVsc","app":"918","route":"createVm","page_content":{"state":{"dataDisk":[1,2,3],"wujiayu":"fithThing"},"methods":{"onClickNew":{"type":"JSFunction","value":"function onClickNew(event) {\n alert('wujiayu')\n}"}},"componentName":"Page","css":"body {\r\n background-color:#eef0f5 ;\r\n margin-bottom: 80px;\r\n}","props":{"onClick":{"type":"JSExpression","value":"this.onClickNew"}},"children":[{"componentName":"div","props":{"style":"padding-bottom: 10px; padding-top: 10px;"},"id":"2b2cabf0","children":[{"componentName":"TinyTimeLine","props":{"active":2,"data":[{"name":"基础配置"},{"name":"网络配置"},{"name":"高级配置"},{"name":"确认配置"}],"horizontal":true,"style":"border-radius: 0px;"},"id":"dd764b17"}]},{"componentName":"div","props":{"style":"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;"},"id":"30c94cc8","children":[{"componentName":"TinyForm","props":{"labelWidth":"80px","labelPosition":"top","inline":false,"label-position":"left ","label-width":"150px","style":"border-radius: 0px;"},"children":[{"componentName":"TinyFormItem","props":{"label":"区域"},"children":[{"componentName":"TinyButtonGroup","props":{"data":[{"text":"乌兰察布二零一","value":"1"}],"modelValue":"1","style":"border-radius: 0px; margin-right: 10px;"},"id":"c97ccd99"},{"componentName":"Text","props":{"text":"温馨提示:页面左上角切换区域","style":"background-color: [object Event]; color: #8a8e99; font-size: 12px;"},"id":"20923497"},{"componentName":"Text","props":{"text":"不同区域的云服务产品之间内网互不相通;请就近选择靠近您业务的区域,可减少网络时延,提高访问速度","style":"display: block; color: #8a8e99; border-radius: 0px; font-size: 12px;"},"id":"54780a26"}],"id":"4966384d"},{"componentName":"TinyFormItem","props":{"label":"可用区","style":"border-radius: 0px;"},"children":[{"componentName":"TinyButtonGroup","props":{"data":[{"text":"可用区1","value":"1"},{"text":"可用区2","value":"2"},{"text":"可用区3","value":"3"}],"modelValue":"1"},"id":"6184481b"}],"id":"690837bf"}],"id":"b6a425d4"}]},{"componentName":"div","props":{"style":"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;"},"children":[{"componentName":"TinyForm","props":{"labelWidth":"80px","labelPosition":"top","inline":false,"label-position":"left ","label-width":"150px","style":"border-radius: 0px;"},"children":[{"componentName":"TinyFormItem","props":{"label":"CPU架构"},"children":[{"componentName":"TinyButtonGroup","props":{"data":[{"text":"x86计算","value":"1"},{"text":"鲲鹏计算","value":"2"}],"modelValue":"1"},"id":"7d33ced7"}],"id":"05ed5a79"},{"componentName":"TinyFormItem","props":{"label":"区域"},"children":[{"componentName":"div","props":{"style":"display: flex; justify-content: flex-start; align-items: center;"},"id":"606edf78","children":[{"componentName":"div","props":{"style":"display: flex; align-items: center; margin-right: 10px;"},"id":"f3f98246","children":[{"componentName":"Text","props":{"text":"vCPUs","style":"width: 80px;"},"id":"c287437e"},{"componentName":"TinySelect","props":{"modelValue":"","placeholder":"请选择","options":[{"value":"1","label":"黄金糕"},{"value":"2","label":"双皮奶"}]},"id":"4c43286b"}]},{"componentName":"div","props":{"style":"display: flex; align-items: center; margin-right: 10px;"},"children":[{"componentName":"Text","props":{"text":"内存","style":"width: 80px; border-radius: 0px;"},"id":"38b8fa1f"},{"componentName":"TinySelect","props":{"modelValue":"","placeholder":"请选择","options":[{"value":"1","label":"黄金糕"},{"value":"2","label":"双皮奶"}]},"id":"cd33328e"}],"id":"2b2c678f"},{"componentName":"div","props":{"style":"display: flex; align-items: center;"},"children":[{"componentName":"Text","props":{"text":"规格名称","style":"width: 80px;"},"id":"d3eb6352"},{"componentName":"TinySearch","props":{"modelValue":"","placeholder":"输入关键词"},"id":"21cb9282"}],"id":"b8e0f35c"},{"componentName":"TinyFormItem","props":{"label":"计费模式"},"children":[{"componentName":"TinyButtonGroup","props":{"data":[{"text":"包年/包月","value":"1"},{"text":"按需计费","value":"2"}],"modelValue":"1"},"id":"a8d84361"}],"id":"9f39f3e7"}]},{"componentName":"div","props":{"style":"border-radius: 0px;"},"id":"5000c83e","children":[{"componentName":"TinyButtonGroup","props":{"data":[{"text":"通用计算型","value":"1"},{"text":"通用计算增强型","value":"2"},{"text":"内存优化型","value":"3"},{"text":"内存优化型","value":"4"},{"text":"磁盘增强型","value":"5"},{"text":"超高I/O型","value":"6"},{"text":"GPU加速型","value":"7"}],"modelValue":"1","style":"border-radius: 0px; margin-top: 12px;"},"id":"b8724703"},{"componentName":"TinyGrid","props":{"editConfig":{"trigger":"click","mode":"cell","showStatus":true},"columns":[{"type":"radio","width":60},{"field":"employees","title":"规格名称"},{"field":"created_date","title":"vCPUs | 内存(GiB)","sortable":true},{"field":"city","title":"CPU","sortable":true},{"title":"基准 / 最大带宽\t","sortable":true},{"title":"内网收发包","sortable":true}],"data":[{"id":"1","name":"GFD科技有限公司","city":"福州","employees":800,"created_date":"2014-04-30 00:56:00","boole":false},{"id":"2","name":"WWW科技有限公司","city":"深圳","employees":300,"created_date":"2016-07-08 12:36:22","boole":true}],"style":"margin-top: 12px; border-radius: 0px;","auto-resize":true},"id":"77701c25"},{"componentName":"div","props":{"style":"margin-top: 12px; border-radius: 0px;"},"id":"3339838b","children":[{"componentName":"Text","props":{"text":"当前规格","style":"width: 150px; display: inline-block;"},"id":"203b012b"},{"componentName":"Text","props":{"text":"通用计算型 | Si2.large.2 | 2vCPUs | 4 GiB","style":"font-weight: 700;"},"id":"87723f52"}]}]}],"id":"657fb2fc"}],"id":"d19b15cf"}],"id":"9991228b"},{"componentName":"div","props":{"style":"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;"},"children":[{"componentName":"TinyForm","props":{"labelWidth":"80px","labelPosition":"top","inline":false,"label-position":"left ","label-width":"150px","style":"border-radius: 0px;"},"children":[{"componentName":"TinyFormItem","props":{"label":"镜像","style":"border-radius: 0px;"},"children":[{"componentName":"TinyButtonGroup","props":{"data":[{"text":"公共镜像","value":"1"},{"text":"私有镜像","value":"2"},{"text":"共享镜像","value":"3"}],"modelValue":"1"},"id":"922b14cb"},{"componentName":"div","props":{"style":"display: flex; margin-top: 12px; border-radius: 0px;"},"id":"6b679524","children":[{"componentName":"TinySelect","props":{"modelValue":"","placeholder":"请选择","options":[{"value":"1","label":"黄金糕"},{"value":"2","label":"双皮奶"}],"style":"width: 170px; margin-right: 10px;"},"id":"4851fff7"},{"componentName":"TinySelect","props":{"modelValue":"","placeholder":"请选择","options":[{"value":"1","label":"黄金糕"},{"value":"2","label":"双皮奶"}],"style":"width: 340px;"},"id":"a7183eb7"}]},{"componentName":"div","props":{"style":"margin-top: 12px;"},"id":"57aee314","children":[{"componentName":"Text","props":{"text":"请注意操作系统的语言类型。","style":"color: #e37d29;"},"id":"56d36c27"}]}],"id":"e3b02436"}],"id":"59aebf2b"}],"id":"87ff7b99"},{"componentName":"div","props":{"style":"border-width: 1px; border-style: solid; border-radius: 4px; border-color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; margin-bottom: 10px;"},"children":[{"componentName":"TinyForm","props":{"labelWidth":"80px","labelPosition":"top","inline":false,"label-position":"left ","label-width":"150px","style":"border-radius: 0px;"},"children":[{"componentName":"TinyFormItem","props":{"label":"系统盘","style":"border-radius: 0px;"},"children":[{"componentName":"div","props":{"style":"display: flex;"},"id":"cddba5b8","children":[{"componentName":"TinySelect","props":{"modelValue":"","placeholder":"请选择","options":[{"value":"1","label":"黄金糕"},{"value":"2","label":"双皮奶"}],"style":"width: 200px; margin-right: 10px;"},"id":"a97fbe15"},{"componentName":"TinyInput","props":{"placeholder":"请输入","modelValue":"","style":"width: 120px; margin-right: 10px;"},"id":"1cde4c0f"},{"componentName":"Text","props":{"text":"GiB \nIOPS上限240,IOPS突发上限5,000","style":"color: #575d6c; font-size: 12px;"},"id":"2815d82d"}]}],"id":"50239a3a"}],"id":"e8582986"},{"componentName":"TinyForm","props":{"labelWidth":"80px","labelPosition":"top","inline":false,"label-position":"left ","label-width":"150px","style":"border-radius: 0px;"},"children":[{"componentName":"TinyFormItem","props":{"label":"数据盘","style":"border-radius: 0px;"},"children":[{"componentName":"div","props":{"style":"margin-top: 12px; display: flex;"},"id":"728c9825","children":[{"componentName":"Icon","props":{"style":"margin-right: 10px; width: 16px; height: 16px;","name":"IconPanelMini"},"id":"fded6930"},{"componentName":"TinySelect","props":{"modelValue":"","placeholder":"请选择","options":[{"value":"1","label":"黄金糕"},{"value":"2","label":"双皮奶"}],"style":"width: 200px; margin-right: 10px;"},"id":"62734e3f"},{"componentName":"TinyInput","props":{"placeholder":"请输入","modelValue":"","style":"width: 120px; margin-right: 10px;"},"id":"667c7926"},{"componentName":"Text","props":{"text":"GiB \nIOPS上限600,IOPS突发上限5,000","style":"color: #575d6c; font-size: 12px; margin-right: 10px;"},"id":"e7bc36d6"},{"componentName":"TinyInput","props":{"placeholder":"请输入","modelValue":"","style":"width: 120px;"},"id":"1bd56dc0"}],"loop":{"type":"JSExpression","value":"this.state.dataDisk"}},{"componentName":"div","props":{"style":"display: flex; margin-top: 12px; border-radius: 0px;"},"children":[{"componentName":"Icon","props":{"name":"IconPlus","style":"width: 16px; height: 16px; margin-right: 10px;"},"id":"65c89f2b"},{"componentName":"Text","props":{"text":"增加一块数据盘","style":"font-size: 12px; border-radius: 0px; margin-right: 10px;"},"id":"cb344071"},{"componentName":"Text","props":{"text":"您还可以挂载 21 块磁盘(云硬盘)","style":"color: #8a8e99; font-size: 12px;"},"id":"80eea996"}],"id":"e9e530ab"}],"id":"078e03ef"}],"id":"ccef886e"}],"id":"0fb7bd74"},{"componentName":"div","props":{"style":"border-width: 1px;z-index:1;border-style: solid; border-color: #ffffff; padding-top: 10px; padding-left: 10px; padding-right: 10px; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px; background-color: #fff; position: fixed; inset: auto 0% 0% 0%; height: 80px; line-height: 80px; border-radius: 0px;"},"children":[{"componentName":"TinyForm","props":{"labelWidth":"80px","labelPosition":"top","inline":false,"label-position":"left ","label-width":"150px","style":"border-radius: 0px;"},"children":[],"id":"21ed4475"},{"componentName":"TinyRow","props":{"style":"border-radius: 0px; height: 100%;"},"children":[{"componentName":"TinyCol","props":{"span":8},"id":"b9d051a5","children":[{"componentName":"TinyRow","props":{"style":"border-radius: 0px;"},"children":[{"componentName":"TinyCol","props":{"span":5,"style":"display: flex;"},"id":"02352776","children":[{"componentName":"Text","props":{"text":"购买量","style":"margin-right: 10px;"},"id":"0cd9ed5c"},{"componentName":"TinyInput","props":{"placeholder":"请输入","modelValue":"","style":"width: 120px; margin-right: 10px;"},"id":"2f9cf442"},{"componentName":"Text","props":{"text":"台"},"id":"facd4481"}]},{"componentName":"TinyCol","props":{"span":7},"id":"82b6c659","children":[{"componentName":"div","props":{},"id":"9cd65874","children":[{"componentName":"Text","props":{"text":"配置费用","style":"font-size: 12px;"},"id":"b5a0a0da"},{"componentName":"Text","props":{"text":"¥1.5776","style":"padding-left: 10px; padding-right: 10px; color: #de504e;"},"id":"d9464214"},{"componentName":"Text","props":{"text":"/小时","style":"font-size: 12px;"},"id":"af7cc5e6"}]},{"componentName":"div","props":{},"id":"89063830","children":[{"componentName":"Text","props":{"text":"参考价格,具体扣费请以账单为准。","style":"font-size: 12px; border-radius: 0px;"},"id":"d8995fbc"},{"componentName":"Text","props":{"text":"了解计费详情","style":"font-size: 12px; color: #344899;"},"id":"b383c3e2"}]}]}],"id":"94fc0e43"}]},{"componentName":"TinyCol","props":{"span":4,"style":"display: flex; flex-direction: row-reverse; border-radius: 0px; height: 100%; justify-content: flex-start; align-items: center;"},"id":"10b73009","children":[{"componentName":"TinyButton","props":{"text":"下一步: 网络配置","type":"danger","style":"max-width: unset;"},"id":"0b584011"}]}],"id":"d414a473"}],"id":"e8ec029b"}],"fileName":"createVm"},"tenant":1,"isBody":false,"parentId":"0","group":"staticPages","depth":0,"isPage":true,"isDefault":false,"occupier":{"id":86,"username":"开发者","email":"developer@lowcode.com","resetPasswordToken":"developer","confirmationToken":"dfb2c162-351f-4f44-ad5f-8998","is_admin":true},"isHome":false,"_id":"NTJ4MjvqoVj8OVsc","message":"Page auto save"} {"$$indexCreated":{"fieldName":"route","unique":true,"sparse":false}} {"$$indexCreated":{"fieldName":"route","unique":true}} -{"name":"DemoPage","id":"5bhD7p5FUsUOTFRN","app":"918","route":"demopage","page_content":{"state":{},"methods":{},"componentName":"Page","css":"","props":{},"lifeCycles":{},"children":[{"componentName":"div","props":{},"id":"85375559","children":[{"componentName":"TinySwitch","props":{"modelValue":""},"id":"33433546"}]}],"dataSource":{"list":[]},"utils":[],"bridge":[],"inputs":[],"outputs":[],"fileName":"DemoPage"},"tenant":1,"isBody":false,"parentId":"0","group":"staticPages","depth":0,"isPage":true,"isDefault":false,"occupier":{"id":86,"username":"开发者","email":"developer@lowcode.com","resetPasswordToken":"developer","confirmationToken":"dfb2c162-351f-4f44-ad5f-8998","is_admin":true},"isHome":false,"message":"Page auto save","_id":"5bhD7p5FUsUOTFRN"} -{"name":"DemoPage","id":"5bhD7p5FUsUOTFRN","app":"918","route":"demopage","page_content":{"state":{},"methods":{},"componentName":"Page","css":"","props":{},"lifeCycles":{},"children":[{"componentName":"div","props":{},"id":"85375559","children":[{"componentName":"TinySwitch","props":{"modelValue":""},"id":"33433546"}]},{"componentName":"AntdRadio","props":{"autoFocus":false,"disabled":false,"checked":false,"defaultChecked":true},"children":[{"componentName":"Text","props":{"text":"单选框Label"},"id":"64425466"}],"id":"766345ce"},{"componentName":"AntdRadioButton","props":{"defaultChecked":true},"children":[{"componentName":"Text","props":{"text":"单选框Label"},"id":"a46d1659"}],"id":"31432525"},{"componentName":"AntdRadioButton","props":{"checked":false,"defaultChecked":true},"children":[{"componentName":"Text","props":{"text":"单选框Label"},"id":"65215462"}],"id":"53342943"}],"dataSource":{"list":[]},"utils":[],"bridge":[],"inputs":[],"outputs":[],"fileName":"DemoPage"},"tenant":1,"isBody":false,"parentId":"0","group":"staticPages","depth":0,"isPage":true,"isDefault":false,"occupier":{"id":86,"username":"开发者","email":"developer@lowcode.com","resetPasswordToken":"developer","confirmationToken":"dfb2c162-351f-4f44-ad5f-8998","is_admin":true},"isHome":false,"message":"Page auto save","_id":"5bhD7p5FUsUOTFRN"} -{"name":"DemoPage","id":"5bhD7p5FUsUOTFRN","app":"918","route":"demopage","page_content":{"state":{},"methods":{},"componentName":"Page","css":"","props":{},"lifeCycles":{},"children":[{"componentName":"div","props":{},"id":"85375559","children":[{"componentName":"TinySwitch","props":{"modelValue":""},"id":"33433546"}]},{"componentName":"AntdRadio","props":{"autoFocus":false,"disabled":false,"checked":false,"defaultChecked":true},"children":[{"componentName":"Text","props":{"text":"单选框Label"},"id":"64425466"}],"id":"766345ce"},{"componentName":"AntdRadioButton","props":{"defaultChecked":true,"checked":false},"children":[{"componentName":"Text","props":{"text":"单选框Label"},"id":"a46d1659"}],"id":"31432525"},{"componentName":"AntdRadioButton","props":{"checked":false,"defaultChecked":true},"children":[{"componentName":"Text","props":{"text":"单选框Label"},"id":"65215462"}],"id":"53342943"}],"dataSource":{"list":[]},"utils":[],"bridge":[],"inputs":[],"outputs":[],"fileName":"DemoPage"},"tenant":1,"isBody":false,"parentId":"0","group":"staticPages","depth":0,"isPage":true,"isDefault":false,"occupier":{"id":86,"username":"开发者","email":"developer@lowcode.com","resetPasswordToken":"developer","confirmationToken":"dfb2c162-351f-4f44-ad5f-8998","is_admin":true},"isHome":false,"message":"Page auto save","_id":"5bhD7p5FUsUOTFRN"} -{"name":"DemoPage","id":"5bhD7p5FUsUOTFRN","app":"918","route":"demopage","page_content":{"state":{},"methods":{},"componentName":"Page","css":"","props":{},"lifeCycles":{},"children":[{"componentName":"div","props":{},"id":"85375559","children":[{"componentName":"TinySwitch","props":{"modelValue":""},"id":"33433546"}]},{"componentName":"AntdRadio","props":{"autoFocus":false,"disabled":false,"defaultChecked":false},"children":[{"componentName":"Text","props":{"text":"单选框Label"},"id":"64425466"}],"id":"766345ce"},{"componentName":"AntdRadioButton","props":{"defaultChecked":true,"checked":false},"children":[{"componentName":"Text","props":{"text":"单选框Label"},"id":"a46d1659"}],"id":"31432525"},{"componentName":"AntdRadioButton","props":{"checked":false,"defaultChecked":true},"children":[{"componentName":"Text","props":{"text":"单选框Label"},"id":"65215462"}],"id":"53342943"}],"dataSource":{"list":[]},"utils":[],"bridge":[],"inputs":[],"outputs":[],"fileName":"DemoPage"},"tenant":1,"isBody":false,"parentId":"0","group":"staticPages","depth":0,"isPage":true,"isDefault":false,"occupier":{"id":86,"username":"开发者","email":"developer@lowcode.com","resetPasswordToken":"developer","confirmationToken":"dfb2c162-351f-4f44-ad5f-8998","is_admin":true},"isHome":false,"message":"Page auto save","_id":"5bhD7p5FUsUOTFRN"} -{"name":"Untitled","id":"","app":"918","route":"Untitled","page_content":{"componentName":"Page","css":"","props":{},"lifeCycles":{},"children":[],"dataSource":{"list":[]},"state":{},"methods":{},"utils":[],"bridge":[],"inputs":[],"outputs":[],"fileName":"Untitled"},"tenant":1,"isBody":false,"parentId":"0","depth":0,"isPage":true,"isDefault":false,"group":"staticPages","occupier":{"id":86,"username":"开发者","email":"developer@lowcode.com","resetPasswordToken":"developer","confirmationToken":"dfb2c162-351f-4f44-ad5f-8998","is_admin":true},"isHome":false,"message":"Page auto save","_id":"Hs85JTrC7z394qVf"} -{"name":"Untitled","id":"Hs85JTrC7z394qVf","app":"918","route":"Untitled","page_content":{"componentName":"Page","css":"","props":{},"lifeCycles":{},"children":[],"dataSource":{"list":[]},"state":{},"methods":{},"utils":[],"bridge":[],"inputs":[],"outputs":[],"fileName":"Untitled"},"tenant":1,"isBody":false,"parentId":"0","depth":0,"isPage":true,"isDefault":false,"group":"staticPages","occupier":{"id":86,"username":"开发者","email":"developer@lowcode.com","resetPasswordToken":"developer","confirmationToken":"dfb2c162-351f-4f44-ad5f-8998","is_admin":true},"isHome":false,"message":"Page auto save","_id":"Hs85JTrC7z394qVf"} -{"name":"Untitled","id":"Hs85JTrC7z394qVf","app":"918","route":"Untitled","page_content":{"state":{},"methods":{},"componentName":"Page","css":"","props":{},"lifeCycles":{},"children":[{"componentName":"AntdRadioButton","props":{"defaultChecked":true,"checked":false},"children":[{"componentName":"Text","props":{"text":"单选框Label"},"id":"326c3324"}],"id":"85a263a4"}],"dataSource":{"list":[]},"utils":[],"bridge":[],"inputs":[],"outputs":[],"fileName":"Untitled"},"tenant":1,"isBody":false,"parentId":"0","depth":0,"isPage":true,"isDefault":false,"group":"staticPages","occupier":{"id":86,"username":"开发者","email":"developer@lowcode.com","resetPasswordToken":"developer","confirmationToken":"dfb2c162-351f-4f44-ad5f-8998","is_admin":true},"isHome":false,"message":"Page auto save","_id":"Hs85JTrC7z394qVf"} diff --git a/mockServer/src/mock/get/app-center/v1/apps/schema/918.json b/mockServer/src/mock/get/app-center/v1/apps/schema/918.json index 17656258e..3a3b25597 100644 --- a/mockServer/src/mock/get/app-center/v1/apps/schema/918.json +++ b/mockServer/src/mock/get/app-center/v1/apps/schema/918.json @@ -752,7 +752,11 @@ "componentsTree": [ { "state": { - "dataDisk": [1, 2, 3] + "dataDisk": [ + 1, + 2, + 3 + ] }, "methods": {}, "componentName": "Page", @@ -1918,13 +1922,6 @@ "destructuring": true, "version": "0.1.17" }, - { - "componentName": "TinyCheckbox", - "package": "@opentiny/vue", - "exportName": "Checkbox", - "destructuring": true, - "version": "3.14.0" - }, { "componentName": "TinySelect", "package": "@opentiny/vue", @@ -1981,76 +1978,6 @@ "destructuring": true, "version": "0.1.16" }, - { - "componentName": "TinyCollapse", - "package": "@opentiny/vue", - "exportName": "Collapse", - "destructuring": true, - "version": "3.14.0" - }, - { - "componentName": "TinyCollapseItem", - "package": "@opentiny/vue", - "exportName": "CollapseItem", - "destructuring": true, - "version": "3.14.0" - }, - { - "componentName": "TinyBreadcrumb", - "package": "@opentiny/vue", - "exportName": "Breadcrumb", - "destructuring": true, - "version": "3.14.0" - }, - { - "componentName": "TinyBreadcrumbItem", - "package": "@opentiny/vue", - "exportName": "BreadcrumbItem", - "destructuring": true, - "version": "3.14.0" - }, - { - "componentName": "ElInput", - "package": "element-plus", - "exportName": "ElInput", - "destructuring": true, - "version": "2.4.2" - }, - { - "componentName": "ElButton", - "package": "element-plus", - "exportName": "ElButton", - "destructuring": true, - "version": "2.4.2" - }, - { - "componentName": "ElForm", - "package": "element-plus", - "exportName": "ElForm", - "destructuring": true, - "version": "2.4.2" - }, - { - "componentName": "ElFormItem", - "package": "element-plus", - "exportName": "ElFormItem", - "destructuring": true, - "version": "2.4.2" - }, - { - "componentName": "ElTable", - "package": "element-plus", - "exportName": "ElTable", - "destructuring": true, - "version": "2.4.2" - }, - { - "componentName": "ElTableColumn", - "package": "element-plus", - "exportName": "ElTableColumn", - "destructuring": true, - "version": "2.4.2" - }, { "componentName": "PortalHome", "main": "common/components/home", @@ -2177,4 +2104,4 @@ "version": "" }, "locale": "zh-cn" -} +} \ No newline at end of file diff --git a/mockServer/src/services/appinfo.json b/mockServer/src/services/appinfo.json index ab75552f6..8c20f6008 100644 --- a/mockServer/src/services/appinfo.json +++ b/mockServer/src/services/appinfo.json @@ -1757,7 +1757,11 @@ "route": "createVm", "page_content": { "state": { - "dataDisk": [1, 2, 3] + "dataDisk": [ + 1, + 2, + 3 + ] }, "methods": {}, "componentName": "Page", @@ -2794,7 +2798,11 @@ "attrs": { "currentPage": 1, "pageSize": 50, - "pageSizes": [10, 20, 50], + "pageSizes": [ + 10, + 20, + 50 + ], "total": 0, "layout": "sizes,total, prev, pager, next, jumper" } @@ -3528,7 +3536,10 @@ "value": "this.state.renderb52aeac9" }, "condition": true, - "loopArgs": ["item", "idx"] + "loopArgs": [ + "item", + "idx" + ] } ] }, @@ -4049,7 +4060,9 @@ "framework": "Vue", "materials": { "blocks": [], - "snippets": [{}], + "snippets": [ + {} + ], "components": [ { "name": { @@ -4089,10 +4102,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": [""] + "properties": [ + "" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], @@ -4205,10 +4227,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": [""] + "properties": [ + "" + ] }, "contextMenu": { - "actions": ["remove", "copy", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "remove", + "copy", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], @@ -4459,10 +4490,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["show-checkbox"] + "properties": [ + "show-checkbox" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "framework": "Vue" @@ -4835,13 +4875,24 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["placement", "trigger"] + "properties": [ + "placement", + "trigger" + ] }, "contextMenu": { - "actions": ["createBlock", "copy"], - "disable": ["copy", "remove"] + "actions": [ + "createBlock", + "copy" + ], + "disable": [ + "copy", + "remove" + ] }, - "slots": ["reference"], + "slots": [ + "reference" + ], "isPopper": true, "framework": "Vue" }, @@ -5384,13 +5435,26 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["text", "", "size"] + "properties": [ + "text", + "", + "size" + ] }, "contextMenu": { - "actions": ["createBlock", "copy", "remove", "insert", "updateAttr", "bindEevent"], + "actions": [ + "createBlock", + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent" + ], "disable": [] }, - "slots": ["content"], + "slots": [ + "content" + ], "isPopper": true, "framework": "Vue" }, @@ -5616,10 +5680,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["span"] + "properties": [ + "span" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "framework": "Vue" @@ -5893,7 +5966,9 @@ "group": "component", "category": "导航组件", "priority": 2, - "snippets": [{}], + "snippets": [ + {} + ], "configure": { "loop": true, "condition": true, @@ -5911,13 +5986,24 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": [""] + "properties": [ + "" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -6116,7 +6202,11 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["text", "", "size"] + "properties": [ + "text", + "", + "size" + ] }, "contextMenu": { "actions": [], @@ -6285,7 +6375,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } }, @@ -6298,7 +6390,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } } @@ -6362,13 +6456,25 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["text", "size"] + "properties": [ + "text", + "size" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -6576,13 +6682,25 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["text", "size"] + "properties": [ + "text", + "size" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -6797,13 +6915,25 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["text", "size"] + "properties": [ + "text", + "size" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -6949,13 +7079,25 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["text", "size"] + "properties": [ + "text", + "size" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -7152,10 +7294,21 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["clearable", "", "mini"] + "properties": [ + "clearable", + "", + "mini" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "createBlock", "bindEevent"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "createBlock", + "bindEevent" + ], "disable": [] }, "slots": [], @@ -7441,7 +7594,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } }, @@ -7454,7 +7609,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } } @@ -7574,10 +7731,20 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["flex", "align"] + "properties": [ + "flex", + "align" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], @@ -7767,7 +7934,9 @@ "group": "component", "category": "表单组件", "priority": 3, - "snippets": [{}], + "snippets": [ + {} + ], "configure": { "loop": true, "condition": true, @@ -7784,13 +7953,24 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": [""] + "properties": [ + "" + ] }, "contextMenu": { - "actions": ["remove", "insert", "copy", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "remove", + "insert", + "copy", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "slots": ["label"], + "slots": [ + "label" + ], "framework": "Vue" }, "createdBy": 169, @@ -7975,13 +8155,25 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["type", "size"] + "properties": [ + "type", + "size" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -8352,7 +8544,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } } @@ -8414,10 +8608,20 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["value", "disabled"] + "properties": [ + "value", + "disabled" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], @@ -9000,10 +9204,21 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["tab-style", "", "size"] + "properties": [ + "tab-style", + "", + "size" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], @@ -9417,13 +9632,24 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": [""] + "properties": [ + "" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -9751,7 +9977,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } }, @@ -9764,7 +9992,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } }, @@ -9777,7 +10007,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } } @@ -9844,10 +10076,21 @@ "isLayout": false, "rootSelector": ".tiny-dialog-box", "shortcuts": { - "properties": ["visible", "", "width"] + "properties": [ + "visible", + "", + "width" + ] }, "contextMenu": { - "actions": ["remove", "insert", "copy", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "remove", + "insert", + "copy", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], @@ -10222,10 +10465,20 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["disabled", "mini"] + "properties": [ + "disabled", + "mini" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], @@ -10507,10 +10760,21 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["horizontal", "", "active"] + "properties": [ + "horizontal", + "", + "active" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "framework": "Vue" @@ -10812,10 +11076,20 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["name", "title"] + "properties": [ + "name", + "title" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], @@ -10988,10 +11262,20 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["text", "size"] + "properties": [ + "text", + "size" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], @@ -11356,10 +11640,21 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["label-width", "", "disabled"] + "properties": [ + "label-width", + "", + "disabled" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], @@ -11825,15 +12120,28 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["columns", "", "resizable"] + "properties": [ + "columns", + "", + "resizable" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], "framework": "Vue", - "invalidity": [""] + "invalidity": [ + "" + ] }, "createdBy": 169, "created_at": "2022-05-19T10:41:29.000Z", @@ -12075,7 +12383,10 @@ "widget": { "component": "MetaJsSlot", "props": { - "slots": ["header", "default"] + "slots": [ + "header", + "default" + ] } } }, @@ -12591,7 +12902,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } }, @@ -12604,7 +12917,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } }, @@ -12617,7 +12932,9 @@ }, "type": "event", "functionInfo": { - "params": ["e"], + "params": [ + "e" + ], "returns": {} } } @@ -12678,13 +12995,25 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["value", "size"] + "properties": [ + "value", + "size" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -13269,7 +13598,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } }, @@ -13282,7 +13613,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } }, @@ -13295,7 +13628,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } } @@ -13334,7 +13669,10 @@ "schema": { "componentName": "TinyCheckboxGroup", "props": { - "modelValue": ["name1", "name2"], + "modelValue": [ + "name1", + "name2" + ], "type": "checkbox", "options": [ { @@ -13395,10 +13733,20 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["text", "size"] + "properties": [ + "text", + "size" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], @@ -13689,10 +14037,21 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["multiple", "", "options"] + "properties": [ + "multiple", + "", + "options" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], @@ -14186,10 +14545,20 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["disabled", "size"] + "properties": [ + "disabled", + "size" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "framework": "Vue" @@ -14364,7 +14733,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } } @@ -14450,13 +14821,24 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["arrow"] + "properties": [ + "arrow" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "slots": ["default"], + "slots": [ + "default" + ], "framework": "Vue" }, "createdBy": 169, @@ -14853,10 +15235,20 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["placeholder", "show-clear-btn"] + "properties": [ + "placeholder", + "show-clear-btn" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "slots": [], @@ -15249,10 +15641,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": [""] + "properties": [ + "" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, "invalidity": [], @@ -15924,13 +16325,25 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["size", "trigger"] + "properties": [ + "size", + "trigger" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -16278,7 +16691,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } }, @@ -16291,7 +16706,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } }, @@ -16304,7 +16721,9 @@ }, "type": "event", "functionInfo": { - "params": [null], + "params": [ + null + ], "returns": {} } } @@ -16344,7 +16763,12 @@ "componentName": "TinyChartHistogram", "props": { "data": { - "columns": ["日期", "访问用户", "下单用户", "下单率"], + "columns": [ + "日期", + "访问用户", + "下单用户", + "下单率" + ], "rows": [ { "日期": "1/1", @@ -16405,13 +16829,24 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": [""] + "properties": [ + "" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -16669,7 +17104,9 @@ "createdBy": null, "updatedBy": null, "assets_url": { - "material": ["http://localhost:9090/assets/json/bundle.json"], + "material": [ + "http://localhost:9090/assets/json/bundle.json" + ], "scripts": [ "http://localhost:9090/assets/js/1505web-components.es.js", "http://localhost:9090/assets/js/1505web-components.umd.js" @@ -16724,13 +17161,25 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["type", "size"] + "properties": [ + "type", + "size" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -17004,13 +17453,25 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["type", "size"] + "properties": [ + "type", + "size" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -17316,7 +17777,9 @@ "isModal": false, "isPopper": false, "nestingRule": { - "childWhitelist": ["ElFormItem"], + "childWhitelist": [ + "ElFormItem" + ], "parentWhitelist": "", "descendantBlacklist": "", "ancestorWhitelist": "" @@ -17325,13 +17788,25 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["inline", "label-width"] + "properties": [ + "inline", + "label-width" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -17782,13 +18257,25 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["inline", "label-width"] + "properties": [ + "inline", + "label-width" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -18123,7 +18610,9 @@ "isModal": false, "isPopper": false, "nestingRule": { - "childWhitelist": ["ElTableColumn"], + "childWhitelist": [ + "ElTableColumn" + ], "parentWhitelist": "", "descendantBlacklist": "", "ancestorWhitelist": "" @@ -18132,13 +18621,25 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["inline", "label-width"] + "properties": [ + "inline", + "label-width" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -19368,13 +19869,25 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["inline", "label-width"] + "properties": [ + "inline", + "label-width" + ] }, "contextMenu": { - "actions": ["copy", "remove", "insert", "updateAttr", "bindEevent", "createBlock"], + "actions": [ + "copy", + "remove", + "insert", + "updateAttr", + "bindEevent", + "createBlock" + ], "disable": [] }, - "invalidity": [""], + "invalidity": [ + "" + ], "clickCapture": true, "framework": "Vue" }, @@ -19521,11 +20034,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["disabled", "size"] + "properties": [ + "disabled", + "size" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -19843,7 +20364,9 @@ "clickCapture": false, "isModal": false, "nestingRule": { - "childWhitelist": ["TinyCarouselItem"], + "childWhitelist": [ + "TinyCarouselItem" + ], "parentWhitelist": "", "descendantBlacklist": "", "ancestorWhitelist": "" @@ -19852,11 +20375,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["disabled", "size"] + "properties": [ + "disabled", + "size" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -20012,7 +20543,14 @@ "name": { "zh_CN": "标题" }, - "component": ["h1", "h2", "h3", "h4", "h5", "h6"], + "component": [ + "h1", + "h2", + "h3", + "h4", + "h5", + "h6" + ], "icon": "h16", "description": "标题", "docUrl": "", @@ -20103,11 +20641,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["disabled", "size"] + "properties": [ + "disabled", + "size" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -20476,11 +21022,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["disabled", "size"] + "properties": [ + "disabled", + "size" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -20733,7 +21287,9 @@ ], "events": {}, "shortcuts": { - "properties": ["src"] + "properties": [ + "src" + ] }, "contentMenu": { "actions": [] @@ -21408,11 +21964,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["disabled", "size"] + "properties": [ + "disabled", + "size" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -21558,11 +22122,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["label-width", "disabled"] + "properties": [ + "label-width", + "disabled" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -21911,11 +22483,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["label-width", "disabled"] + "properties": [ + "label-width", + "disabled" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -22038,7 +22618,9 @@ "isModal": false, "nestingRule": { "childWhitelist": "", - "parentWhitelist": ["TinyForm"], + "parentWhitelist": [ + "TinyForm" + ], "descendantBlacklist": "", "ancestorWhitelist": "" }, @@ -22046,11 +22628,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["label", "rules"] + "properties": [ + "label", + "rules" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -22328,11 +22918,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["label", "rules"] + "properties": [ + "label", + "rules" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -22668,11 +23266,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["text", "size"] + "properties": [ + "text", + "size" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -23083,11 +23689,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["value", "disabled"] + "properties": [ + "value", + "disabled" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -23322,11 +23936,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["visible", "width"] + "properties": [ + "visible", + "width" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -23730,11 +24352,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["multiple", "options"] + "properties": [ + "multiple", + "options" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -23932,11 +24562,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["disabled", "mini"] + "properties": [ + "disabled", + "mini" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -24211,11 +24849,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["clearable", "mini"] + "properties": [ + "clearable", + "mini" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -24470,11 +25116,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["border", "disabled"] + "properties": [ + "border", + "disabled" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -24661,11 +25315,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["text", "size"] + "properties": [ + "text", + "size" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -24872,11 +25534,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["disabled", "type"] + "properties": [ + "disabled", + "type" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -25152,11 +25822,19 @@ "isLayout": false, "rootSelector": ".tiny-dialog-box", "shortcuts": { - "properties": ["visible", "width"] + "properties": [ + "visible", + "width" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -25428,7 +26106,9 @@ "clickCapture": false, "isModal": false, "nestingRule": { - "childWhitelist": ["TinyTabItem"], + "childWhitelist": [ + "TinyTabItem" + ], "parentWhitelist": [], "descendantBlacklist": [], "ancestorWhitelist": [] @@ -25437,11 +26117,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["size", "tab-style"] + "properties": [ + "size", + "tab-style" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -25542,7 +26230,9 @@ "isModal": false, "nestingRule": { "childWhitelist": "", - "parentWhitelist": ["TinyTab"], + "parentWhitelist": [ + "TinyTab" + ], "descendantBlacklist": "", "ancestorWhitelist": "" }, @@ -25550,11 +26240,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["name", "title"] + "properties": [ + "name", + "title" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -25677,7 +26375,9 @@ "clickCapture": false, "isModal": false, "nestingRule": { - "childWhitelist": ["TinyBreadcrumbItem"], + "childWhitelist": [ + "TinyBreadcrumbItem" + ], "parentWhitelist": [], "descendantBlacklist": [], "ancestorWhitelist": [] @@ -25686,11 +26386,18 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["separator"] + "properties": [ + "separator" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -25771,7 +26478,9 @@ "isModal": false, "nestingRule": { "childWhitelist": "", - "parentWhitelist": ["TinyBreadcrumb"], + "parentWhitelist": [ + "TinyBreadcrumb" + ], "descendantBlacklist": "", "ancestorWhitelist": "" }, @@ -25779,11 +26488,18 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["to"] + "properties": [ + "to" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -25911,11 +26627,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["label-width", "disabled"] + "properties": [ + "label-width", + "disabled" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -26026,11 +26750,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["label-width", "disabled"] + "properties": [ + "label-width", + "disabled" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -26247,7 +26979,10 @@ "widget": { "component": "MetaJsSlot", "props": { - "slots": ["header", "default"] + "slots": [ + "header", + "default" + ] } } }, @@ -26925,10 +27660,15 @@ } }, "shortcuts": { - "properties": ["sortable", "columns"] + "properties": [ + "sortable", + "columns" + ] }, "contentMenu": { - "actions": ["create symbol"] + "actions": [ + "create symbol" + ] }, "onBeforeMount": "console.log('table on load'); this.pager = source.pager; this.fetchData = source.fetchData; this.data = source.data ;this.columns = source.columns" }, @@ -26948,11 +27688,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["sortable", "columns"] + "properties": [ + "sortable", + "columns" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -27185,11 +27933,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["currentPage", "total"] + "properties": [ + "currentPage", + "total" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -27551,11 +28307,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["modelValue", "disabled"] + "properties": [ + "modelValue", + "disabled" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -27867,11 +28631,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["data", "show-checkbox"] + "properties": [ + "data", + "show-checkbox" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -28076,11 +28848,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["active", "data"] + "properties": [ + "active", + "data" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -28276,11 +29056,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["disabled", "content"] + "properties": [ + "disabled", + "content" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -28762,11 +29550,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["visible", "width"] + "properties": [ + "visible", + "width" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -29178,11 +29974,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["value", "disabled"] + "properties": [ + "value", + "disabled" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } }, @@ -29623,11 +30427,19 @@ "isLayout": false, "rootSelector": "", "shortcuts": { - "properties": ["value", "disabled"] + "properties": [ + "value", + "disabled" + ] }, "contextMenu": { - "actions": ["create symbol"], - "disable": ["copy", "remove"] + "actions": [ + "create symbol" + ], + "disable": [ + "copy", + "remove" + ] } } } @@ -29709,4 +30521,4 @@ } } } -} +} \ No newline at end of file diff --git a/mockServer/src/services/block.js b/mockServer/src/services/block.js index f29c00ad6..c8071fe10 100644 --- a/mockServer/src/services/block.js +++ b/mockServer/src/services/block.js @@ -72,8 +72,7 @@ export default class BlockService { async detail(blockId) { const result = await this.db.findOneAsync({ _id: blockId }) - - return getResponseData(result) + return result } async delete(blockId) { diff --git a/package.json b/package.json index 3f249b781..d84852308 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,9 @@ "private": true, "scripts": { "preinstall": "npx only-allow pnpm", - "dev": "pnpm run setup && concurrently 'pnpm:serve:backend' 'pnpm:serve:frontend'", + "dev": "pnpm run setup && concurrently 'pnpm:serve:backend' 'pnpm:serve:frontend' 'pnpm:serve:design-core'", "dev:mock": "pnpm --filter @opentiny/tiny-engine dev", + "serve:design-core": "pnpm --filter ./packages/design-core/src/previewReact run dev", "serve:frontend": "pnpm --filter @opentiny/tiny-engine serve", "serve:backend": "pnpm --filter @opentiny/tiny-engine-mock dev", "build:plugin": "pnpm --filter @opentiny/tiny-engine-* build", @@ -25,6 +26,8 @@ }, "devDependencies": { "@babel/eslint-parser": "^7.21.3", + "@esbuild-plugins/node-globals-polyfill": "^0.2.3", + "@esbuild-plugins/node-modules-polyfill": "^0.2.2", "@types/node": "^18.0.0", "@vitejs/plugin-vue": "^4.2.3", "@vitejs/plugin-vue-jsx": "^3.1.0", @@ -70,4 +73,4 @@ "veaury@2.3.16": "patches/veaury@2.3.16.patch" } } -} +} \ No newline at end of file diff --git a/packages/blockToWebComponentTemplate/package.json b/packages/blockToWebComponentTemplate/package.json index cd7f0dc8f..4124d3074 100644 --- a/packages/blockToWebComponentTemplate/package.json +++ b/packages/blockToWebComponentTemplate/package.json @@ -1,6 +1,6 @@ { "name": "@opentiny/tiny-engine-block-build", - "version": "1.0.5", + "version": "1.0.2", "description": "translate block to webcomponent template", "main": "./dist/web-components.es.js", "scripts": { diff --git a/packages/blockToWebComponentTemplate/vite.config.js b/packages/blockToWebComponentTemplate/vite.config.js index 9ad6a1861..ddbf655c3 100644 --- a/packages/blockToWebComponentTemplate/vite.config.js +++ b/packages/blockToWebComponentTemplate/vite.config.js @@ -43,7 +43,7 @@ export default defineConfig(({ command, mode }) => { } const vuePluginConfig = {} - const styleLinks = ['https://unpkg.com/@opentiny/vue-theme@3.14/index.css'] + const styleLinks = ['https://npm.onmicrosoft.cn/@opentiny/vue-theme@3.14/index.css'] config.publicDir = false diff --git a/packages/builtinComponent/package.json b/packages/builtinComponent/package.json index 805d0a7f1..f25d3a77d 100644 --- a/packages/builtinComponent/package.json +++ b/packages/builtinComponent/package.json @@ -1,6 +1,6 @@ { "name": "@opentiny/tiny-engine-builtin-component", - "version": "1.0.4", + "version": "1.0.1", "description": "", "main": "dist/index.js", "module": "dist/index.js", diff --git a/packages/canvas/package.json b/packages/canvas/package.json index 7288e61aa..b798c0227 100644 --- a/packages/canvas/package.json +++ b/packages/canvas/package.json @@ -1,6 +1,6 @@ { "name": "@opentiny/tiny-engine-canvas", - "version": "1.0.6", + "version": "1.0.3", "publishConfig": { "access": "public" }, diff --git a/packages/canvas/src/components/container/CanvasAction.vue b/packages/canvas/src/components/container/CanvasAction.vue index ec2164da0..c5d6a66aa 100644 --- a/packages/canvas/src/components/container/CanvasAction.vue +++ b/packages/canvas/src/components/container/CanvasAction.vue @@ -229,10 +229,7 @@ export default { } const showAction = computed(() => { - const { schema, parent } = getCurrent() - if (schema?.props?.['data-id'] === 'root-container') { - return false - } + const { parent } = getCurrent() return !props.resize && parent && parent?.type !== 'JSSlot' }) diff --git a/packages/canvas/src/components/container/container.js b/packages/canvas/src/components/container/container.js index 404694b39..375ef80ed 100644 --- a/packages/canvas/src/components/container/container.js +++ b/packages/canvas/src/components/container/container.js @@ -185,8 +185,6 @@ export const dragEnd = () => { if (element && canvasState.type === 'absolute') { data.props = data.props || {} data.props.style = element.style.cssText - - getController().addHistory() } // 重置拖拽状态 @@ -544,8 +542,6 @@ const setHoverRect = (element, data) => { return undefined } -let moveUpdateTimer = null - // 绝对布局 const absoluteMove = (event, element) => { const { clientX, clientY } = event @@ -577,19 +573,6 @@ const absoluteMove = (event, element) => { element.style.height = `${clientY - y}px` } } - - clearTimeout(moveUpdateTimer) - - const { data } = dragState - data.props = data.props || {} - - // 防抖更新位置信息到 schema - moveUpdateTimer = setTimeout(() => { - data.props.style = element.style.cssText - - getController().addHistory() - }, 100) - updateRect() } @@ -734,7 +717,11 @@ export const onMouseUp = () => { if (absolute) { targetNode.node = getSchema() data.props = data.props || {} - data.props.style = `position: absolute; top: ${dragState.mouse.y}px; left: ${dragState.mouse.x}px` + data.props.style = { + position: 'absolute', + top: dragState.mouse.y + 'px', + left: dragState.mouse.x + 'px' + } } insertNode(targetNode, position) diff --git a/packages/canvas/src/components/render/RenderMain.js b/packages/canvas/src/components/render/RenderMain.js index 93a39622b..6081d487e 100644 --- a/packages/canvas/src/components/render/RenderMain.js +++ b/packages/canvas/src/components/render/RenderMain.js @@ -379,8 +379,7 @@ export default { // 渲染画布增加根节点,与出码和预览保持一致 const rootChildrenSchema = { componentName: 'div', - // 手动添加一个唯一的属性,后续在画布选中此节点时方便处理额外的逻辑。由于没有修改schema,不会影响出码 - props: { ...schema.props, 'data-id': 'root-container' }, + props: schema.props, children: schema.children } diff --git a/packages/canvas/src/components/render/render.js b/packages/canvas/src/components/render/render.js index 4fc860a4e..7668fcb8a 100644 --- a/packages/canvas/src/components/render/render.js +++ b/packages/canvas/src/components/render/render.js @@ -581,7 +581,7 @@ const getBindProps = (schema, scope) => { ...parseData(schema.props, scope), [DESIGN_UIDKEY]: id, [DESIGN_TAGKEY]: componentName, - onMouseover: stopEvent, + onMouseOver: stopEvent, onFocus: stopEvent } if (scope) { diff --git a/packages/common/component/BlockDeployDialog.vue b/packages/common/component/BlockDeployDialog.vue index ecb2a5a46..33aaf918e 100644 --- a/packages/common/component/BlockDeployDialog.vue +++ b/packages/common/component/BlockDeployDialog.vue @@ -82,7 +82,7 @@ import { FormItem as TinyFormItem } from '@opentiny/vue' import { theme } from '@opentiny/tiny-engine-controller/adapter' -import { useLayout, useNotify, useCanvas, useBlock } from '@opentiny/tiny-engine-controller' +import { useLayout, useNotify, useCanvas } from '@opentiny/tiny-engine-controller' import { constants } from '@opentiny/tiny-engine-utils' import VueMonaco from './VueMonaco.vue' @@ -163,7 +163,7 @@ export default { const { getEditBlock, publishBlock } = getPluginApi(PLUGIN_NAME.BlockManage) if (valid) { const params = { - block: getEditBlock() || useBlock().getCurrentBlock(), + block: getEditBlock(), is_compile: true, deploy_info: formState.deployInfo, version: formState.version, diff --git a/packages/common/component/ConfigItem.vue b/packages/common/component/ConfigItem.vue index 1f46dc695..c0fd195e7 100644 --- a/packages/common/component/ConfigItem.vue +++ b/packages/common/component/ConfigItem.vue @@ -295,13 +295,16 @@ export default { result.message = typeof message === 'string' ? message : message?.[locale.value] } - const isEmptyInputValue = (value) => { - // 通过 value == null 做隐式类型转换 - // 空值约定为 undefined | null | '' - return value == null || (typeOf(value) === TYPES.StringType && value.trim() === '') - } const verifyRequired = (value) => { - return !isEmptyInputValue(value) + if (typeOf(value) === TYPES.BooleanType) { + return true + } + + if (typeOf(value) === TYPES.StringType) { + return value.trim() + } + + return value } const verifyValue = (value = '', rules = []) => { diff --git a/packages/common/component/LifeCycles.vue b/packages/common/component/LifeCycles.vue index fd8404fd4..7d213edd3 100644 --- a/packages/common/component/LifeCycles.vue +++ b/packages/common/component/LifeCycles.vue @@ -10,12 +10,8 @@
@@ -47,22 +43,15 @@
- +
@@ -129,7 +118,7 @@ export default { }) watchEffect(() => { - state.bindLifeCycles = props.bindLifeCycles || {} + state.bindLifeCycles = props.bindLifeCycles || useCanvas().canvasApi.value?.getSchema()?.lifeCycles || {} }) const searchLifeCyclesList = (value) => { @@ -255,28 +244,34 @@ export default { display: flex; // 决定了鼠标移入后的弹窗位置 padding: 10px; margin-top: -10px; + svg { outline: none; } } + .popover-list { ul li:first-child { margin-top: 8px; } + ul li:last-child { margin-bottom: 8px; } } + .life-cycle-alert { color: var(--ti-lowcode-life-cycle-alert-color); margin-left: 20px; margin-right: 20px; } + .add-life-cycle-wrap { display: flex; font-size: 16px; margin-left: 10px; align-items: center; + .desc { margin: 0; margin-left: 8px; @@ -287,10 +282,12 @@ export default { li { padding: 8px 30px 8px 16px; cursor: pointer; + &:hover { background: var(--ti-lowcode-life-cycle-item-hover-bg); } } + .existed { cursor: not-allowed; pointer-events: none; @@ -305,6 +302,7 @@ export default { .dialog-content { display: flex; height: 100%; + .dialog-content-left { width: 200px; margin-right: 20px; @@ -342,6 +340,7 @@ export default { .dialog-content-right { flex: 1; + .life-cycle-editor { border: 1px solid var(--ti-lowcode-life-cycle-editor-border); height: 100%; diff --git a/packages/common/component/MetaJsSlot.vue b/packages/common/component/MetaJsSlot.vue index a580f7b7f..87af9ae50 100644 --- a/packages/common/component/MetaJsSlot.vue +++ b/packages/common/component/MetaJsSlot.vue @@ -17,13 +17,13 @@ @@ -84,41 +84,33 @@ export default { const paramsPropPath = (index) => `${index}.params` - const paramsStringValidator = (rule, value, callback) => { - if (value && value.split(',').some((param) => !verifyJsVarName(param))) { + const parmasStringValidator = (rule, value, callback) => { + if (value && value.split(',').some((parma) => !verifyJsVarName(parma))) { callback(new Error('仅支持JavaScript中有效的变量名')) } else { callback() } } - const updateSlotParams = (slotData) => { - emit('update:modelValue', slotData) - - // 更新当前选中组件的根属性,不更新在jsslot中的数据非响应式 - const [propsName] = path.split('.') - const schema = useProperties().getSchema() - schema.props[propsName] = JSON.parse(JSON.stringify(schema.props[propsName])) - } - - const setSlotParams = ({ name, params = '' }) => { - if (!props.modelValue?.[name]) { - return + const toggleSlot = (idx, { bind, name, params = '' }) => { + const slotInfo = { + [name]: { + type: 'JSSlot', + value: [ + { + componentName: 'div' + } + ] + } } - const slotData = { ...(props.modelValue || {}) } + const slotData = { ...slotInfo, ...(props.modelValue || {}) } if (params.length) { slotData[name].params = params.split(',') } else { delete slotData[name].params } - - updateSlotParams(slotData) - } - - const toggleSlot = (idx, { bind, name, params = '' }) => { - // 原本绑定的,解除绑定 if (bind) { useModal().confirm({ title: '提示', @@ -126,39 +118,33 @@ export default { status: 'info', exec: () => { slotList.value[idx].bind = false - const { [name]: _deleted, ...rest } = { ...(props.modelValue || {}) } - updateSlotParams(rest) - } + delete slotData[name] + emit('update:modelValue', slotData) + const [propsName] = path.split('.') + const schema = useProperties().getSchema() + schema.props[propsName] = JSON.parse(JSON.stringify(schema.props[propsName])) + }, + cancel: () => {} }) - - return - } - - // 未绑定的,新增绑定 - slotList.value[idx].bind = true - - const slotInfo = { - [name]: { - type: 'JSSlot', - value: [ - { - componentName: 'div' - } - ] - } + } else { + slotList.value[idx].bind = true } + emit('update:modelValue', slotData) - if (params.length) { - slotInfo[name].params = params.split(',') - } + // 更新当前选中组件的根属性,不根新在jsslot中的数据非响应式 + const [propsName] = path.split('.') + const schema = useProperties().getSchema() + schema.props[propsName] = JSON.parse(JSON.stringify(schema.props[propsName])) + } - updateSlotParams({ ...(props.modelValue || {}), ...slotInfo }) + const setParams = (slot) => { + slot.bind && toggleSlot(true, slot) } - const validParams = (paramsPath, slot) => { - slotRef.value.validateField([paramsPath], (error) => { - if (!error) { - slot.bind && setSlotParams(slot) + const validParmas = (slot, parmasPath) => { + slotRef.value.validateField([parmasPath], (tips) => { + if (!tips) { + setParams(slot) } }) } @@ -173,8 +159,9 @@ export default { slotList, paramsPropPath, slotRef, - paramsStringValidator, - validParams, + parmasStringValidator, + validParmas, + setParams, state, componentsMap } diff --git a/packages/common/package.json b/packages/common/package.json index b10f65934..a2ced557c 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@opentiny/tiny-engine-common", - "version": "1.0.5", + "version": "1.0.2", "publishConfig": { "access": "public" }, diff --git a/packages/controller/js/http.js b/packages/controller/js/http.js index e4528350f..c3315a066 100644 --- a/packages/controller/js/http.js +++ b/packages/controller/js/http.js @@ -14,7 +14,6 @@ import { useHttp } from '@opentiny/tiny-engine-http' import usePage from '../src/usePage' import useCanvas from '../src/useCanvas' import useNotify from '../src/useNotify' -import useBreadcrumb from '../src/useBreadcrumb' import { isVsCodeEnv } from './environments' import { generateRouter, generatePage } from './vscodeGenerateFile' @@ -40,7 +39,7 @@ export const requestEvent = (url, params) => { * @returns { Promise } * */ -export const handlePageUpdate = (pageId, params, routerChange, isCurEditPage) => { +export const handlePageUpdate = (pageId, params, routerChange) => { return http .post(`/app-center/api/pages/update/${pageId}`, params) .then((res) => { @@ -61,19 +60,14 @@ export const handlePageUpdate = (pageId, params, routerChange, isCurEditPage) => } } - // 更新页面管理的列表,如果不存在,说明还没有打开过页面管理面板 - pageSettingState.updateTreeData?.() + if (routerChange) { + pageSettingState.updateTreeData() + } pageSettingState.isNew = false useNotify({ message: '保存成功!', type: 'success' }) // 更新 页面状态 标志 setSaved(true) - - if (isCurEditPage) { - const { setBreadcrumbPage } = useBreadcrumb() - setBreadcrumbPage([params.name]) - } - return res }) .catch((err) => { diff --git a/packages/controller/js/verification.js b/packages/controller/js/verification.js index 5bb5b5ff3..3276983d3 100644 --- a/packages/controller/js/verification.js +++ b/packages/controller/js/verification.js @@ -1,20 +1,20 @@ /** - * Copyright (c) 2023 - present TinyEngine Authors. - * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. - * - * Use of this source code is governed by an MIT-style license. - * - * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, - * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR - * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. - * - */ +* Copyright (c) 2023 - present TinyEngine Authors. +* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. +* +* Use of this source code is governed by an MIT-style license. +* +* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, +* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR +* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. +* +*/ export const REGEXP_EVENT_NAME = /^[a-z]+([A-Z][a-z]*)*$/ export const verifyEventName = (name) => REGEXP_EVENT_NAME.test(name) -export const REGEXP_BLOCK_NAME = /^([A-Z][a-z0-9]*){2,}$/ +export const REGEXP_BLOCK_NAME = /^([A-Z][A-Za-z0-9]{2,})*?([A-Z][A-Za-z0-9]{2,})*?$/ export const verifyBlockName = (string) => REGEXP_BLOCK_NAME.test(string) diff --git a/packages/controller/package.json b/packages/controller/package.json index 1bece1c15..ac207b0d5 100644 --- a/packages/controller/package.json +++ b/packages/controller/package.json @@ -1,6 +1,6 @@ { "name": "@opentiny/tiny-engine-controller", - "version": "1.0.6", + "version": "1.0.3", "publishConfig": { "access": "public" }, diff --git a/packages/controller/src/useResource.js b/packages/controller/src/useResource.js index b3d3afd98..5df4dfa8d 100644 --- a/packages/controller/src/useResource.js +++ b/packages/controller/src/useResource.js @@ -293,7 +293,7 @@ const initBlock = async (blockId) => { const blockApi = getPluginApi(PLUGIN_NAME.BlockManage) const blockContent = await blockApi.getBlockById(blockId) - if (blockContent?.public_scope_tenants?.length) { + if (blockContent.public_scope_tenants.length) { blockContent.public_scope_tenants = blockContent.public_scope_tenants.map((e) => e.id) } diff --git a/packages/design-core/.env.alpha b/packages/design-core/.env.alpha index 6cd7ceea6..1816a0471 100644 --- a/packages/design-core/.env.alpha +++ b/packages/design-core/.env.alpha @@ -1,7 +1,7 @@ # alpha mode, used by the "build:alpha" script NODE_ENV=production -VITE_CDN_DOMAIN=https://unpkg.com +VITE_CDN_DOMAIN=https://npm.onmicrosoft.cn VITE_LOCAL_IMPORT_MAPS=false VITE_LOCAL_BUNDLE_DEPS=false # VITE_ORIGIN= diff --git a/packages/design-core/.env.development b/packages/design-core/.env.development index e02fbee0f..98c505478 100644 --- a/packages/design-core/.env.development +++ b/packages/design-core/.env.development @@ -1,7 +1,7 @@ # development mode, used by the "vite" command NODE_ENV=development -VITE_CDN_DOMAIN=https://unpkg.com +VITE_CDN_DOMAIN=https://npm.onmicrosoft.cn VITE_LOCAL_IMPORT_MAPS=false VITE_LOCAL_BUNDLE_DEPS=false # request data via alpha service diff --git a/packages/design-core/.env.prod b/packages/design-core/.env.prod index 8768ec32c..04b27fbc3 100644 --- a/packages/design-core/.env.prod +++ b/packages/design-core/.env.prod @@ -1,7 +1,7 @@ # prod mode, used by the "build:prod" script NODE_ENV=production -VITE_CDN_DOMAIN=https://unpkg.com +VITE_CDN_DOMAIN=https://npm.onmicrosoft.cn VITE_LOCAL_IMPORT_MAPS=false VITE_LOCAL_BUNDLE_DEPS=false #VITE_ORIGIN= diff --git a/packages/design-core/config/addons.js b/packages/design-core/config/addons.js index 72bd13851..ef264a109 100644 --- a/packages/design-core/config/addons.js +++ b/packages/design-core/config/addons.js @@ -21,7 +21,7 @@ import Save from '@opentiny/tiny-engine-toolbar-save' import Clean from '@opentiny/tiny-engine-toolbar-clean' import Preview from '@opentiny/tiny-engine-toolbar-preview' import GenerateVue from '@opentiny/tiny-engine-toolbar-generate-vue' -import GenerateReact from '@opentiny/tiny-engine-toolbar-generate-react' +import GenerateReact from '@opentiny/tiny-engine-toolbar-generate-vue' import Refresh from '@opentiny/tiny-engine-toolbar-refresh' import Collaboration from '@opentiny/tiny-engine-toolbar-collaboration' import Setting from '@opentiny/tiny-engine-toolbar-setting' diff --git a/packages/design-core/config/lowcode.config.js b/packages/design-core/config/lowcode.config.js index eeff8c0ad..47e7fec8a 100644 --- a/packages/design-core/config/lowcode.config.js +++ b/packages/design-core/config/lowcode.config.js @@ -92,9 +92,12 @@ export default { ], HTML: [], React: [ + // 'useEffect', + // 'useMemo', + // 'useState' 'componentWillMount', 'componentDidMount', - 'componentWillReceiveProps', + // 'componentWillReceiveProps', // 被弃用了 'shouldComponentUpdate', 'componentWillUpdate', 'componentDidUpdate', diff --git a/packages/design-core/package.json b/packages/design-core/package.json index 1c35118c8..cc10ad6b5 100644 --- a/packages/design-core/package.json +++ b/packages/design-core/package.json @@ -1,6 +1,6 @@ { "name": "@opentiny/tiny-engine", - "version": "1.0.0", + "version": "1.0.0-beta.4", "description": "TinyEngine enables developers to customize low-code platforms, build low-bit platforms online in real time, and support secondary development or integration of low-bit platform capabilities.", "homepage": "https://opentiny.design/tiny-engine", "keywords": [ @@ -90,6 +90,7 @@ "eslint-linter-browserify": "8.57.0", "file-saver": "^2.0.5", "html2canvas": "^1.4.1", + "jszip": "^3.10.1", "monaco-editor": "0.33.0", "prettier": "2.7.1", "sortablejs": "^1.14.0", @@ -107,7 +108,6 @@ "assert": "^2.0.0", "buffer": "^6.0.3", "cross-env": "^7.0.3", - "esbuild": "^0.21.5", "esbuild-plugin-copy": "^2.1.1", "eslint": "^8.38.0", "eslint-plugin-vue": "^8.0.0", diff --git a/packages/design-core/public/mock/bundle.json b/packages/design-core/public/mock/bundle.json index 462f304a7..719c17e64 100644 --- a/packages/design-core/public/mock/bundle.json +++ b/packages/design-core/public/mock/bundle.json @@ -1576,11 +1576,10 @@ "npm": { "package": "element-plus", "version": "2.4.2", - "script": "https://unpkg.com/element-plus@2.4.2/dist/index.full.mjs", - "css": "https://unpkg.com/element-plus@2.4.2/dist/index.css", + "script": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.full.mjs", + "css": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.css", "dependencies": null, - "exportName": "ElInput", - "destructuring": true + "exportName": "ElInput" }, "group": "表单组件", "category": "element-plus", @@ -1857,11 +1856,10 @@ "npm": { "package": "element-plus", "version": "2.4.2", - "script": "https://unpkg.com/element-plus@2.4.2/dist/index.full.mjs", - "css": "https://unpkg.com/element-plus@2.4.2/dist/index.css", + "script": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.full.mjs", + "css": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.css", "dependencies": null, - "exportName": "ElButton", - "destructuring": true + "exportName": "ElButton" }, "group": "基础组件", "category": "element-plus", @@ -2179,10 +2177,9 @@ "npm": { "package": "element-plus", "version": "2.4.2", - "script": "https://unpkg.com/element-plus@2.4.2/dist/index.full.mjs", - "css": "https://unpkg.com/element-plus@2.4.2/dist/index.css", + "script": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.full.mjs", + "css": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.css", "dependencies": null, - "destructuring": true, "exportName": "ElForm" }, "group": "表单组件", @@ -2637,10 +2634,9 @@ "npm": { "package": "element-plus", "version": "2.4.2", - "script": "https://unpkg.com/element-plus@2.4.2/dist/index.full.mjs", - "css": "https://unpkg.com/element-plus@2.4.2/dist/index.css", + "script": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.full.mjs", + "css": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.css", "dependencies": null, - "destructuring": true, "exportName": "ElFormItem" }, "group": "表单组件", @@ -2988,10 +2984,9 @@ "npm": { "package": "element-plus", "version": "2.4.2", - "script": "https://unpkg.com/element-plus@2.4.2/dist/index.full.mjs", - "css": "https://unpkg.com/element-plus@2.4.2/dist/index.css", + "script": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.full.mjs", + "css": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.css", "dependencies": null, - "destructuring": true, "exportName": "ElTable" }, "group": "数据展示", @@ -4227,10 +4222,9 @@ "npm": { "package": "element-plus", "version": "2.4.2", - "script": "https://unpkg.com/element-plus@2.4.2/dist/index.full.mjs", - "css": "https://unpkg.com/element-plus@2.4.2/dist/index.css", + "script": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.full.mjs", + "css": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.css", "dependencies": null, - "destructuring": true, "exportName": "ElTableColumn" }, "group": "表单组件", @@ -10463,7 +10457,7 @@ "devMode": "proCode", "npm": { "package": "@opentiny/vue", - "exportName": "Breadcrumb", + "exportName": "Select", "version": "", "destructuring": true }, @@ -12100,7 +12094,7 @@ "devMode": "proCode", "npm": { "package": "@opentiny/vue", - "exportName": "Popeditor", + "exportName": "PopEditor", "version": "", "destructuring": true }, @@ -15722,10 +15716,20 @@ "schema": { "componentName": "TinyBreadcrumb", "props": { - "options": { - "type": "JSExpression", - "value": "[{to: { path: '/' },label: '首页'},{to: { path: '/breadcrumb' },label: '产品'},{'replace': true,'label': '软件'}]" - } + "options": [ + { + "to": "{ path: '/' }", + "label": "首页" + }, + { + "to": "{ path: '/breadcrumb' }", + "label": "产品" + }, + { + "replace": "true", + "label": "软件" + } + ] } } }, @@ -15980,7 +15984,7 @@ "schema": { "componentName": "TinyTimeLine", "props": { - "active": 2, + "active": "2", "data": [ { "name": "已下单" diff --git a/packages/design-core/src/preview/src/App.vue b/packages/design-core/src/preview/src/App.vue index bc57e710b..703bc1220 100644 --- a/packages/design-core/src/preview/src/App.vue +++ b/packages/design-core/src/preview/src/App.vue @@ -1,17 +1,21 @@ \ No newline at end of file diff --git a/packages/design-core/src/preview/src/preview/Preview.vue b/packages/design-core/src/preview/src/preview/Preview.vue index 3a16bb278..2c9743ee3 100644 --- a/packages/design-core/src/preview/src/preview/Preview.vue +++ b/packages/design-core/src/preview/src/preview/Preview.vue @@ -1,15 +1,8 @@ @@ -18,13 +11,16 @@ import { defineComponent, computed, defineAsyncComponent } from 'vue' import { Repl, ReplStore } from '@vue/repl' import vueJsx from '@vue/babel-plugin-jsx' import { transformSync } from '@babel/core' +import Config from '../../../../config/lowcode.config.js' import { genSFCWithDefaultPlugin, parseRequiredBlocks } from '@opentiny/tiny-engine-dsl-vue' import importMap from './importMap' import srcFiles from './srcFiles' +import { ref } from 'vue' import generateMetaFiles, { processAppJsCode } from './generate' import { getSearchParams, fetchMetaData, fetchImportMap, fetchAppSchema, fetchBlockSchema } from './http' import { PanelType, PreviewTips } from '../constant' import { injectDebugSwitch } from './debugSwitch' +// import IframeVue from '../iframe/index.vue' import '@vue/repl/style.css' const Monaco = defineAsyncComponent(() => import('@vue/repl/monaco-editor')) // 异步组件实现懒加载,打开debug后再加载 @@ -37,13 +33,17 @@ const EmptyEditor = defineComponent({ export default { components: { - Repl + Repl, + // IframeVue }, setup() { const debugSwitch = injectDebugSwitch() const editorComponent = computed(() => (debugSwitch?.value ? Monaco : EmptyEditor)) const store = new ReplStore() + const showIframe = ref(Config.dslMode === 'React'); + const iframeSrc = 'http://127.0.0.1:5173/'; // 你想要嵌入的 URL + const sfcOptions = { script: { // scirpt setup 编译后注入 import { * } from "vue" @@ -86,17 +86,11 @@ export default { .map((name) => fetchBlockSchema(name)) const schemaList = await Promise.allSettled(promiseList) - const extraList = [] schemaList.forEach((item) => { if (item.status === 'fulfilled' && item.value?.[0]?.content) { res.push(item.value[0].content) - extraList.push(getBlocksSchema(item.value[0].content, blockSet)) - } - }) - ;(await Promise.allSettled(extraList)).forEach((item) => { - if (item.status === 'fulfilled' && item.value) { - res.push(...item.value) + res.push(...getBlocksSchema(item.value[0].content, blockSet)) } }) @@ -142,10 +136,11 @@ export default { }, ...(blocks || []).map((blockSchema) => { return { - panelName: `${blockSchema.fileName}.vue`, + panelName: blockSchema.fileName, panelValue: genSFCWithDefaultPlugin(blockSchema, appData?.componentsMap || [], { blockRelativePath: './' }) || '', - panelType: 'vue' + panelType: 'vue', + index: true } }) ] @@ -155,7 +150,7 @@ export default { const fixScriptLang = (generatedCode) => { const fixedCode = { ...generatedCode } - if (generatedCode.panelType === PanelType.VUE) { + if (generatedCode.panelType === PanelType.REACT) { fixedCode.panelValue = generatedCode.panelValue.replace(langReg, '') } @@ -210,13 +205,22 @@ export default { store, sfcOptions, editorComponent, - debugSwitch + debugSwitch, + showIframe, + iframeSrc, + // handleIframeMessage, + srcFiles } } } `); + + newFiles[panelName] = newPanelValue + } + + // const appJsCode = processAppJsCode(newFiles['app.js'], queryParams.styles) + + // newFiles['app.js'] = appJsCode + + pageCode.forEach(assignFiles) + + const metaFiles = generateMetaFiles(metaData) // 有报错,需要处理一下 + Object.assign(newFiles, metaFiles) + + return PreviewTips.READY_FOR_PREVIEW + }) + + return { + debugSwitch, + showIframe, + iframeSrc, + newFiles, + } + } +} + + + diff --git a/packages/design-core/src/preview/src/previewReact/generate.js b/packages/design-core/src/preview/src/previewReact/generate.js new file mode 100644 index 000000000..50e011dd7 --- /dev/null +++ b/packages/design-core/src/preview/src/previewReact/generate.js @@ -0,0 +1,175 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +const generateDefaultExport = (data) => + data && typeof data === 'object' ? `export default ${JSON.stringify(data, null, 2)}`.trim() : 'export default {}' + +const generateStores = (globalState) => { + if (!Array.isArray(globalState)) { + return 'export {}' + } + + const result = ["import create from 'zustand'\n"] + + globalState.forEach(({ id, state, actions }) => { + const stateExpression = `${Object.entries(state) + .map((item) => { + let [key, value] = item + + if (value === '') { + value = "''" + } + + if (value || typeof value === 'object') { + value = JSON.stringify(value) + } + + return [key, value].join(':') + }) + .join(',')}` + + const actionExpressions = Object.entries(actions) + .filter((item) => item[1]?.type === 'JSFunction') + .map( + ([key, value]) => `${key}: () => set((state) => { + ${value.value.replace('this.', 'state.')} + })` + ) + .join(',') + + const storeCode = `export const ${id} = create((set) => ({ + ${stateExpression}, + ${actionExpressions} + }))` + + result.push(storeCode) + }) + + return result.join('\n') +} + +const generateBridge = () => 'export default {}' + +const checkIsValidFunString = (str) => { + if (!str) { + return false + } + try { + const F = Function + const func = new F(`return ${str}`) + const type = Object.prototype.toString.call(func) + + return type === '[object Function]' || type === '[object AsyncFunction]' + } catch (error) { + return false + } +} + +function generateImportsByType({ item, imports, exportNames, functionStrs }) { + if (item.type === 'npm') { + const importFrom = `${item.content.package || ''}${item.content.main || ''}` + + if (importFrom) { + imports[importFrom] = imports[importFrom] || {} + const importItem = imports[importFrom] + + if (item.content.destructuring) { + importItem.destructurings = importItem.destructurings || [] + importItem.destructurings.push(item.content.exportName) + importItem.aliases = importItem.aliases || [] + importItem.aliases.push(item.name) + } else { + importItem.exportName = item.name + } + + exportNames.push(item.name) + } + } else if (item.type === 'function' && checkIsValidFunString(item.content.value)) { + functionStrs.push(`const ${item.name} = ${item.content.value}`) + exportNames.push(item.name) + } +} + +function generateStrsFromImports({ imports, strs, functionStrs, exportNames }) { + const importStrs = [] + + Object.entries(imports).forEach(([key, value]) => { + const list = [] + + if (value.exportName) { + list.push(value.exportName) + } + + if (Array.isArray(value.destructurings) && value.destructurings.length) { + const destructuringsWithAliases = value.destructurings.map((destructuring, index) => { + const alias = value.aliases[index] + if (destructuring === alias) { + return destructuring + } + return `${destructuring} as ${alias}` + }) + list.push(`{ ${destructuringsWithAliases.join(', ')} }`) + } + + importStrs.push(`import ${list.join(', ')} from '${key}'`) + }) + + strs.push(...importStrs, ...functionStrs) + + if (exportNames.length) { + strs.push(`export { ${exportNames.join(', ')} }`) + } +} + +const generateUtils = (list) => { + const strs = [] + + if (Array.isArray(list)) { + const exportNames = [] + const functionStrs = [] + const imports = {} + + list.forEach((item) => { + generateImportsByType({ item, imports, exportNames, functionStrs }) + }) + + generateStrsFromImports({ imports, strs, functionStrs, exportNames }) + } + + return strs.join('\n') +} + +/** + * 处理css文件依赖 + * @param {*} code 源代码 + * @param {*} cssList css文件 + * @returns + */ +export const processAppJsCode = (code, cssList) => { + return `${code}${cssList.map((css) => `addCss('${css}')`).join('\n')}` +} + +export default (data) => { + const locales = generateDefaultExport(data.i18n) + const dataSource = generateDefaultExport(data.dataSource) + const stores = generateStores(data.globalState) + const bridge = generateBridge(data.bridge) + const utils = generateUtils(data.utils) + + return { + 'locales.js': locales, + 'dataSource.js': dataSource, + 'stores.js': stores, + 'bridge.js': bridge, + 'utils.js': utils + } +} diff --git a/packages/design-core/src/preview/src/previewReact/srcFiles.js b/packages/design-core/src/preview/src/previewReact/srcFiles.js new file mode 100644 index 000000000..954d0e965 --- /dev/null +++ b/packages/design-core/src/preview/src/previewReact/srcFiles.js @@ -0,0 +1,108 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +import appVue from './srcFiles/App.jsx?raw' +import injectGlobalJS from './srcFiles/injectGlobal.js?raw' +import constantJS from './srcFiles/constant/index.js?raw' +import appJS from './srcFiles/app.js?raw' +import mainVue from './srcFiles/Main.jsx?raw' +import lowcodeJS from './srcFiles/lowcode.js?raw' +import dataSourceMapJS from './srcFiles/dataSourceMap.js?raw' +import dataSourceJS from './srcFiles/dataSource.js?raw' +import utilsJS from './srcFiles/utils.js?raw' +import bridgeJS from './srcFiles/bridge.js?raw' +import localesJS from './srcFiles/locales.js?raw' +import storesJS from './srcFiles/stores.js?raw' +import storesHelperJS from './srcFiles/storesHelper.js?raw' + +const srcFiles = {} + +srcFiles['App.jsx'] = appVue +srcFiles['Main.jsx'] = mainVue +srcFiles['constant.js'] = constantJS +srcFiles['app.js'] = appJS.replace(/VITE_CDN_DOMAIN/g, import.meta.env.VITE_CDN_DOMAIN) +srcFiles['injectGlobal.js'] = injectGlobalJS +srcFiles['lowcode.js'] = lowcodeJS +srcFiles['dataSourceMap.js'] = dataSourceMapJS +srcFiles['dataSource.js'] = dataSourceJS +srcFiles['utils.js'] = utilsJS +srcFiles['bridge.js'] = bridgeJS +srcFiles['locales.js'] = localesJS +srcFiles['stores.js'] = storesJS +srcFiles['storesHelper.js'] = storesHelperJS + +export const genPreviewTemplate = () => { + return [ + { + fileName: 'App.jsx', + path: '', + fileContent: appVue + }, + { + fileName: 'constant.js', + path: '', + fileContent: constantJS + }, + { + fileName: 'app.js', + path: '', + fileContent: appJS.replace(/VITE_CDN_DOMAIN/g, import.meta.env.VITE_CDN_DOMAIN) + }, + { + fileName: 'injectGlobal.js', + path: '', + fileContent: injectGlobalJS + }, + { + fileName: 'lowcode.js', + path: '', + fileContent: lowcodeJS + }, + { + fileName: 'dataSourceMap.js', + path: '', + fileContent: dataSourceMapJS + }, + { + fileName: 'dataSource.js', + path: '', + fileContent: dataSourceJS + }, + { + fileName: 'utils.js', + path: '', + fileContent: utilsJS + }, + { + fileName: 'bridge.js', + path: '', + fileContent: bridgeJS + }, + { + fileName: 'locales.js', + path: '', + fileContent: localesJS + }, + { + fileName: 'stores.js', + path: '', + fileContent: storesJS + }, + { + fileName: 'storesHelper.js', + path: '', + fileContent: storesHelperJS + } + ] +} + +export default srcFiles diff --git a/packages/design-core/src/previewReact/.gitignore b/packages/design-core/src/previewReact/.gitignore new file mode 100644 index 000000000..a547bf36d --- /dev/null +++ b/packages/design-core/src/previewReact/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/packages/design-core/src/previewReact/README.md b/packages/design-core/src/previewReact/README.md new file mode 100644 index 000000000..f768e33fc --- /dev/null +++ b/packages/design-core/src/previewReact/README.md @@ -0,0 +1,8 @@ +# React + Vite + +This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. + +Currently, two official plugins are available: + +- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh +- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh diff --git a/packages/design-core/src/previewReact/eslint.config.js b/packages/design-core/src/previewReact/eslint.config.js new file mode 100644 index 000000000..6a26c3a8d --- /dev/null +++ b/packages/design-core/src/previewReact/eslint.config.js @@ -0,0 +1,36 @@ +import js from '@eslint/js' +import globals from 'globals' +import react from 'eslint-plugin-react' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' + +export default [ + { ignores: ['dist'] }, + { + files: ['**/*.{js,jsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + parserOptions: { + ecmaVersion: 'latest', + ecmaFeatures: { jsx: true }, + sourceType: 'module' + } + }, + settings: { react: { version: '18.3' } }, + plugins: { + react, + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh + }, + rules: { + ...js.configs.recommended.rules, + ...react.configs.recommended.rules, + ...react.configs['jsx-runtime'].rules, + ...reactHooks.configs.recommended.rules, + 'react/jsx-no-target-blank': 'off', + 'react/prop-types': 'off', + 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }] + } + } +] diff --git a/packages/design-core/src/previewReact/index.html b/packages/design-core/src/previewReact/index.html new file mode 100644 index 000000000..2d45a965e --- /dev/null +++ b/packages/design-core/src/previewReact/index.html @@ -0,0 +1,16 @@ + + + + + + + + Vite + React + + + +
+ + + + \ No newline at end of file diff --git a/packages/design-core/src/previewReact/package.json b/packages/design-core/src/previewReact/package.json new file mode 100644 index 000000000..cdfa68151 --- /dev/null +++ b/packages/design-core/src/previewReact/package.json @@ -0,0 +1,32 @@ +{ + "name": "previewreact", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "lint": "eslint .", + "preview": "vite preview" + }, + "dependencies": { + "antd": "^5.21.6", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-jsx-parser": "^2.2.0", + "react-live": "^4.1.7", + "react-monaco-editor": "^0.56.2" + }, + "devDependencies": { + "@eslint/js": "^9.13.0", + "@types/react": "^18.3.11", + "@types/react-dom": "^18.3.1", + "@vitejs/plugin-react": "^4.3.3", + "eslint": "^9.13.0", + "eslint-plugin-react": "^7.37.1", + "eslint-plugin-react-hooks": "^5.0.0", + "eslint-plugin-react-refresh": "^0.4.13", + "globals": "^15.11.0", + "vite": "^5.4.9" + } +} diff --git a/packages/design-core/src/previewReact/src/App.css b/packages/design-core/src/previewReact/src/App.css new file mode 100644 index 000000000..e69de29bb diff --git a/packages/design-core/src/previewReact/src/App.jsx b/packages/design-core/src/previewReact/src/App.jsx new file mode 100644 index 000000000..98a5a3632 --- /dev/null +++ b/packages/design-core/src/previewReact/src/App.jsx @@ -0,0 +1,29 @@ +import { useState, useEffect } from 'react' +import ReactLive from './component/reactLive' +const App = () => { + const [views, setViews] = useState({}) + useEffect(() => { + const handleMessage = (event) => { + // 验证消息来源 + setViews(event.data?.message) + if (event.data.key === 'files') { + window.parent.postMessage('OK', '*') + } + } + + // 监听来自父窗口的消息 + window.addEventListener('message', handleMessage, false) + + // 清理事件监听器 + return () => { + // window.removeEventListener('message', handleMessage) + } + }, []) + return ( +
+ +
+ ) +} + +export default App diff --git a/packages/design-core/src/previewReact/src/component/case/index.jsx b/packages/design-core/src/previewReact/src/component/case/index.jsx new file mode 100644 index 000000000..26fad57bc --- /dev/null +++ b/packages/design-core/src/previewReact/src/component/case/index.jsx @@ -0,0 +1,3 @@ +export const Case = () => { + return
case
+} diff --git a/packages/design-core/src/previewReact/src/component/constant/index.js b/packages/design-core/src/previewReact/src/component/constant/index.js new file mode 100644 index 000000000..d4a0db13a --- /dev/null +++ b/packages/design-core/src/previewReact/src/component/constant/index.js @@ -0,0 +1,7 @@ +// 需要选择性为文件注入 scope +export const fileScope = { + 'App.jsx': ['Main.jsx'], + 'dataSourceMap.js': ['dataSources.js'], + 'lowcode.js': ['dataSourceMap.js', 'utils.js', 'bridge.js', 'storesHelper.js'], + 'storesHelper.js': ['stores.js'] +} diff --git a/packages/design-core/src/previewReact/src/component/errorboundry/index.jsx b/packages/design-core/src/previewReact/src/component/errorboundry/index.jsx new file mode 100644 index 000000000..c17d0df14 --- /dev/null +++ b/packages/design-core/src/previewReact/src/component/errorboundry/index.jsx @@ -0,0 +1,13 @@ +import React from 'react' + +// 自定义错误边界组件 +export class ErrorBoundary extends React.Component { + componentDidCatch() { + // 当发生错误时,打印错误信息 + // console.error('Caught an error:', error) + } + + render() { + return this.props.children + } +} diff --git a/packages/design-core/src/previewReact/src/component/fileSelector/index.css b/packages/design-core/src/previewReact/src/component/fileSelector/index.css new file mode 100644 index 000000000..31d9aa673 --- /dev/null +++ b/packages/design-core/src/previewReact/src/component/fileSelector/index.css @@ -0,0 +1,9 @@ +.button-group { + display: flex; +} + +.each-button { + height: 20px; + padding: 10px; + border: 1px solid green; +} \ No newline at end of file diff --git a/packages/design-core/src/previewReact/src/component/fileSelector/index.jsx b/packages/design-core/src/previewReact/src/component/fileSelector/index.jsx new file mode 100644 index 000000000..a7e5882c8 --- /dev/null +++ b/packages/design-core/src/previewReact/src/component/fileSelector/index.jsx @@ -0,0 +1,37 @@ +import { Tabs } from 'antd' +// import srcFiles from '../../srcFiles' +import './index.css' +/** + * + * @param {{files: {fileName: string, fileContent: string}[], onSelectFile: () => void}} props + * @returns + */ +export const FileSelector = (props) => { + const { onSelectFile } = props + return ( +
+ { + onSelectFile(event.target?.innerText) + }} + // items={Object.keys(srcFiles)?.map((fileName, index) => { + // const id = String(index) + // return { + // label: fileName.toString(), + // key: id + // // children: `Content of tab ${id}` + // } + // })} + items={[ + { + label: 'Main.jsx', + key: 'Main.jsx' + } + ]} + /> +
+ ) +} diff --git a/packages/design-core/src/previewReact/src/component/monacoEditor/index.css b/packages/design-core/src/previewReact/src/component/monacoEditor/index.css new file mode 100644 index 000000000..e69de29bb diff --git a/packages/design-core/src/previewReact/src/component/monacoEditor/index.jsx b/packages/design-core/src/previewReact/src/component/monacoEditor/index.jsx new file mode 100644 index 000000000..3162f7d0b --- /dev/null +++ b/packages/design-core/src/previewReact/src/component/monacoEditor/index.jsx @@ -0,0 +1,58 @@ +import { useRef } from 'react' +import MonacoEditor from 'react-monaco-editor' +import * as monaco from 'monaco-editor' + +export const ReactMonacoEditor = ({ code, onChange }) => { + const editorRef = useRef(null) + // 定义自定义主题 + monaco.editor.defineTheme('myCustomTheme', { + base: 'vs', // 继承默认亮色主题 + inherit: true, + rules: [ + { token: 'comment', foreground: '008800', fontStyle: 'italic' }, + { token: 'keyword', foreground: '0000ff' }, + { token: 'identifier', foreground: '000000' }, + { token: 'string', foreground: 'a31515' } + // 添加其他高亮规则 + ], + colors: { + 'editor.foreground': '#000000', // 文字颜色设置为黑色 + 'editor.background': '#FFFFFF', // 背景颜色设置为白色 + 'editorCursor.foreground': '#000000', // 光标颜色设置为黑色 + 'editor.lineHighlightBackground': '#0000FF20', // 行高亮背景 + 'editorLineNumber.foreground': '#008800' // 行号颜色 + } + }) + + // 设置主题 + monaco.editor.setTheme('myCustomTheme') + + const handleEditorDidMount = (editor, monaco) => { + editorRef.current = editor + + // 在编辑器加载完成后设置格式化 + monaco.editor.setModelLanguage(editor.getModel(), 'javascript') + + // 添加格式化快捷键 (例如: Ctrl+S) + editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, () => { + editor.getAction('editor.action.formatDocument').run() + }) + } + + return ( + + ) +} + +export default MonacoEditor diff --git a/packages/design-core/src/previewReact/src/component/reactLive/index.css b/packages/design-core/src/previewReact/src/component/reactLive/index.css new file mode 100644 index 000000000..e69de29bb diff --git a/packages/design-core/src/previewReact/src/component/reactLive/index.jsx b/packages/design-core/src/previewReact/src/component/reactLive/index.jsx new file mode 100644 index 000000000..038123dac --- /dev/null +++ b/packages/design-core/src/previewReact/src/component/reactLive/index.jsx @@ -0,0 +1,91 @@ +import { useRef, useState, useLayoutEffect } from 'react' +import prettier from 'prettier' +import parserHtml from 'prettier/parser-html' +import parseCss from 'prettier/parser-postcss' +import parserBabel from 'prettier/parser-babel' +import { LiveProvider, LiveError, LivePreview } from 'react-live' +import * as Antd from 'antd' +import { parseView } from '../util/parseViews' +import srcFiles from '../../srcFiles' +import { FileSelector } from '../fileSelector/index' +import { ReactMonacoEditor } from '../monacoEditor' +import { ErrorBoundary } from '../errorboundry' +import './index.css' + +const defaultOption = { + singleQuote: true, + printWidth: 120, + semi: false, + trailingComma: 'none' +} + +const App = (props) => { + const fileName = useRef('') + const newContent = useRef('') + const { views } = props + + const [code, setCode] = useState(srcFiles['Main.jsx'] || '') + const [scope, setScope] = useState({ Antd }) + + const handleFileChange = (file) => { + setCode(srcFiles[file]) + fileName.current = file + } + + const handleChange = (newCode) => { + setCode(newCode) + srcFiles[fileName.current] = newCode + } + + useLayoutEffect(() => { + if (!views || Object.keys(views).length === 0) return + + const formattedCode = prettier.format(views['Main.jsx'] || '', { + parser: 'babel', + plugins: [parserBabel, parseCss, parserHtml, ...(defaultOption.customPlugin || [])], + ...defaultOption + }) + + views['Main.jsx'] = formattedCode + newContent.current = parseView(views) + + if (newContent.current) { + srcFiles['Main.jsx'] = newContent.current + // 主动触发一下选择函数 + handleFileChange('Main.jsx') + } + }, [views]) + + // 需要选择性为文件注入 scope + useLayoutEffect(() => { + let temp = { Antd } + + Object.keys(srcFiles).forEach((eachFileName) => { + // 传入scope的组件名不能与当前所点击的文件名一致 + if (eachFileName !== fileName.current) { + const tranFileName = eachFileName.split('.')[0] + temp[tranFileName] = srcFiles[eachFileName] + } + }) + setScope(temp) + }, []) + + return ( +
+ + +
+ + handleChange(newCode)} code={code} /> + +
+
+ +
+
+
+
+ ) +} + +export default App diff --git a/packages/design-core/src/previewReact/src/component/util/parseViews.js b/packages/design-core/src/previewReact/src/component/util/parseViews.js new file mode 100644 index 000000000..9cee855c2 --- /dev/null +++ b/packages/design-core/src/previewReact/src/component/util/parseViews.js @@ -0,0 +1,20 @@ +import { capitalizeFirstLetter } from '../../../../../../react-generator/src/utils/uaperCase' +export const parseView = (views) => { + if (!views || Object.keys(views).length === 0) { + return + } + + const name = capitalizeFirstLetter(views['pageInfo']['name']) + let code = views['Main.jsx'] + + code = code.replace(/Antd/g, 'Antd.') + + // 使用正则表达式删除所有 import 语句 + const noImportContent = + code + .replace(/^import\s+\{[^}]+\}\s+from\s+['"][^'"]+['"];?$/gm, '') + .replace(/^import\s+.*$/gm, '') + .replace(/export\s+default\s+[A-Za-z0-9_]+\s*/, '') + `\n render(<${name}/>)` + + return noImportContent +} diff --git a/packages/design-core/src/previewReact/src/index.css b/packages/design-core/src/previewReact/src/index.css new file mode 100644 index 000000000..e69de29bb diff --git a/packages/design-core/src/previewReact/src/main.jsx b/packages/design-core/src/previewReact/src/main.jsx new file mode 100644 index 000000000..e14d575c2 --- /dev/null +++ b/packages/design-core/src/previewReact/src/main.jsx @@ -0,0 +1,10 @@ +import { StrictMode } from 'react' +import { createRoot } from 'react-dom/client' +import './index.css' +import App from './App.jsx' + +createRoot(document.getElementById('root')).render( + + + +) diff --git a/packages/design-core/src/previewReact/src/srcFiles.js b/packages/design-core/src/previewReact/src/srcFiles.js new file mode 100644 index 000000000..fe808043d --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles.js @@ -0,0 +1,108 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +import AppJsx from './srcFiles/app.jsx?raw' +import injectGlobalJS from './srcFiles/injectGlobal.js?raw' +import constantJS from './srcFiles/constant/index.js?raw' +import appJS from './srcFiles/app.js?raw' +import MainJsx from './srcFiles/main.jsx?raw' +import lowcodeJS from './srcFiles/lowcode.js?raw' +import dataSourceMapJS from './srcFiles/dataSourceMap.js?raw' +import dataSourceJS from './srcFiles/dataSource.js?raw' +import utilsJS from './srcFiles/utils.js?raw' +import bridgeJS from './srcFiles/bridge.js?raw' +import localesJS from './srcFiles/locales.js?raw' +import storesJS from './srcFiles/stores.js?raw' +import storesHelperJS from './srcFiles/storesHelper.js?raw' + +const srcFiles = {} + +srcFiles['App.jsx'] = AppJsx +srcFiles['Main.jsx'] = MainJsx +srcFiles['constant.js'] = constantJS +srcFiles['app.js'] = appJS.replace(/VITE_CDN_DOMAIN/g, import.meta.env.VITE_CDN_DOMAIN) +srcFiles['injectGlobal.js'] = injectGlobalJS +srcFiles['lowcode.js'] = lowcodeJS +srcFiles['dataSourceMap.js'] = dataSourceMapJS +srcFiles['dataSource.js'] = dataSourceJS +srcFiles['utils.js'] = utilsJS +srcFiles['bridge.js'] = bridgeJS +srcFiles['locales.js'] = localesJS +srcFiles['stores.js'] = storesJS +srcFiles['storesHelper.js'] = storesHelperJS + +export const genPreviewTemplate = () => { + return [ + { + fileName: 'App.jsx', + path: '', + fileContent: AppJsx + }, + { + fileName: 'constant.js', + path: '', + fileContent: constantJS + }, + { + fileName: 'app.js', + path: '', + fileContent: appJS.replace(/VITE_CDN_DOMAIN/g, import.meta.env.VITE_CDN_DOMAIN) + }, + { + fileName: 'injectGlobal.js', + path: '', + fileContent: injectGlobalJS + }, + { + fileName: 'lowcode.js', + path: '', + fileContent: lowcodeJS + }, + { + fileName: 'dataSourceMap.js', + path: '', + fileContent: dataSourceMapJS + }, + { + fileName: 'dataSource.js', + path: '', + fileContent: dataSourceJS + }, + { + fileName: 'utils.js', + path: '', + fileContent: utilsJS + }, + { + fileName: 'bridge.js', + path: '', + fileContent: bridgeJS + }, + { + fileName: 'locales.js', + path: '', + fileContent: localesJS + }, + { + fileName: 'stores.js', + path: '', + fileContent: storesJS + }, + { + fileName: 'storesHelper.js', + path: '', + fileContent: storesHelperJS + } + ] +} + +export default srcFiles diff --git a/packages/design-core/src/previewReact/src/srcFiles/app.js b/packages/design-core/src/previewReact/src/srcFiles/app.js new file mode 100644 index 000000000..d3654b847 --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/app.js @@ -0,0 +1,20 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +function addCss(href) { + const link = document.createElement('link') + link.setAttribute('rel', 'stylesheet') + link.setAttribute('href', href) + document.head.appendChild(link) +} +addCss('VITE_CDN_DOMAIN/@opentiny/vue-theme@3.14/index.css') +addCss('VITE_CDN_DOMAIN/@opentiny/vue-theme-mobile@3.14/index.css') diff --git a/packages/design-core/src/previewReact/src/srcFiles/app.jsx b/packages/design-core/src/previewReact/src/srcFiles/app.jsx new file mode 100644 index 000000000..148f1f55b --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/app.jsx @@ -0,0 +1,7 @@ +// import '../injectGlobal.js' +// import './App.jsx' +import Main from './main.jsx' +const App = () => { + return
+} +export default App diff --git a/packages/design-core/src/previewReact/src/srcFiles/bridge.js b/packages/design-core/src/previewReact/src/srcFiles/bridge.js new file mode 100644 index 000000000..ef458adc7 --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/bridge.js @@ -0,0 +1,13 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +export default {} diff --git a/packages/design-core/src/previewReact/src/srcFiles/constant/index.js b/packages/design-core/src/previewReact/src/srcFiles/constant/index.js new file mode 100644 index 000000000..b166abbbe --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/constant/index.js @@ -0,0 +1,22 @@ +/** +* Copyright (c) 2023 - present TinyEngine Authors. +* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. +* +* Use of this source code is governed by an MIT-style license. +* +* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, +* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR +* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. +* +*/ + +const BROADCAST_CHANNEL = { + PreviewLang: 'tiny-lowcode-preview-lang' +} + +export const I18N_KEY_MAPS = { + zhCN: 'zh_CN', + enUS: 'en_US' +} + +export { BROADCAST_CHANNEL } diff --git a/packages/design-core/src/previewReact/src/srcFiles/dataSource.js b/packages/design-core/src/previewReact/src/srcFiles/dataSource.js new file mode 100644 index 000000000..cfa7dfce6 --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/dataSource.js @@ -0,0 +1,16 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +export default { + list: [], + dataHandler: null +} diff --git a/packages/design-core/src/previewReact/src/srcFiles/dataSourceMap.js b/packages/design-core/src/previewReact/src/srcFiles/dataSourceMap.js new file mode 100644 index 000000000..17b018be9 --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/dataSourceMap.js @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +import dataSources from './dataSource.js' + +const dataSourceMap = {} + +Array.isArray(dataSources.list) && + dataSources.list.forEach((config) => { + const dataSource = { config: config.data } + + const result = { + code: '', + msg: 'success', + data: {} + } + result.data = + dataSource.config.type === 'array' + ? { items: dataSource?.config?.data, total: dataSource?.config?.data?.length } + : dataSource?.config?.data + dataSourceMap[config.name] = dataSource + + dataSource.load = () => Promise.resolve(result) + }) + +export default dataSourceMap diff --git a/packages/design-core/src/previewReact/src/srcFiles/injectGlobal.js b/packages/design-core/src/previewReact/src/srcFiles/injectGlobal.js new file mode 100644 index 000000000..16d422eda --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/injectGlobal.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +import * as Vue from 'vue' +import * as VueI18n from 'vue-i18n' + +window.Vue = Vue +window.VueI18n = VueI18n diff --git a/packages/design-core/src/previewReact/src/srcFiles/locales.js b/packages/design-core/src/previewReact/src/srcFiles/locales.js new file mode 100644 index 000000000..f2ce64045 --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/locales.js @@ -0,0 +1,16 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +export default { + zh_CN: {}, + en_US: {} +} diff --git a/packages/design-core/src/previewReact/src/srcFiles/login.jsx b/packages/design-core/src/previewReact/src/srcFiles/login.jsx new file mode 100644 index 000000000..7d1e12b35 --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/login.jsx @@ -0,0 +1,12 @@ +import React from 'react' + +const Login = () => { + const url = React.useRef('') + return ( +
+ +
+ ) +} + +export default Login diff --git a/packages/design-core/src/previewReact/src/srcFiles/lowcode.js b/packages/design-core/src/previewReact/src/srcFiles/lowcode.js new file mode 100644 index 000000000..22d96c1b6 --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/lowcode.js @@ -0,0 +1,92 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +import { getCurrentInstance, nextTick, provide, inject } from 'vue' +import { I18nInjectionKey } from 'vue-i18n' +import dataSourceMap from './dataSourceMap.js' +import * as utils from './utils.js' +import * as bridge from './bridge.js' +import { useStores } from './storesHelper.js' +import { Modal } from '@opentiny/vue' + +export const lowcodeWrap = (props, context) => { + const global = {} + const instance = getCurrentInstance() + const router = new Proxy( + {}, + { + get() { + Modal.alert('页面和区块预览不支持路由操作,请使用应用预览', '提示') + return () => {} + } + } + ) + const { t, locale } = inject(I18nInjectionKey).global + const emit = context.emit + const ref = (ref) => instance.refs[ref] + + const setState = (newState, callback) => { + Object.assign(global.state, newState) + nextTick(() => callback?.apply(global)) + } + + const getLocale = () => locale.value + const setLocale = (val) => { + locale.value = val + } + + const location = () => window.location + const history = () => window.history + + Object.defineProperties(global, { + props: { get: () => props }, + emit: { get: () => emit }, + setState: { get: () => setState }, + router: { get: () => router }, + i18n: { get: () => t }, + getLocale: { get: () => getLocale }, + setLocale: { get: () => setLocale }, + location: { get: location }, + history: { get: history }, + utils: { get: () => utils }, + bridge: { get: () => bridge }, + dataSourceMap: { get: () => dataSourceMap }, + $: { get: () => ref } + }) + + const wrap = (fn) => { + if (typeof fn === 'function') { + return (...args) => fn.apply(global, args) + } + + Object.entries(fn).forEach(([name, value]) => { + Object.defineProperty(global, name, { + get: () => value + }) + }) + + fn.t = t + + return fn + } + + return wrap +} + +export default () => { + const i18n = inject(I18nInjectionKey) + provide(I18nInjectionKey, i18n) + + const stores = useStores() + + return { t: i18n.global.t, stores, lowcodeWrap } +} diff --git a/packages/design-core/src/previewReact/src/srcFiles/main.jsx b/packages/design-core/src/previewReact/src/srcFiles/main.jsx new file mode 100644 index 000000000..4a0901443 --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/main.jsx @@ -0,0 +1,5 @@ +const Main = () => { + return

页面加载中...

+} + +export default Main diff --git a/packages/design-core/src/previewReact/src/srcFiles/stores.js b/packages/design-core/src/previewReact/src/srcFiles/stores.js new file mode 100644 index 000000000..ff4ee0aa0 --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/stores.js @@ -0,0 +1,13 @@ +/** +* Copyright (c) 2023 - present TinyEngine Authors. +* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. +* +* Use of this source code is governed by an MIT-style license. +* +* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, +* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR +* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. +* +*/ + +export {} diff --git a/packages/design-core/src/previewReact/src/srcFiles/storesHelper.js b/packages/design-core/src/previewReact/src/srcFiles/storesHelper.js new file mode 100644 index 000000000..f766b5445 --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/storesHelper.js @@ -0,0 +1,29 @@ +/** +* Copyright (c) 2023 - present TinyEngine Authors. +* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. +* +* Use of this source code is governed by an MIT-style license. +* +* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, +* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR +* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. +* +*/ + +import * as userDefinedStores from './stores.js' + +const validStore = (store) => typeof store === 'function' && store.name === 'useStore' && store.$id + +const useStores = () => { + const stores = {} + + Object.values(userDefinedStores) + .filter(validStore) + .forEach((store) => { + stores[store.$id] = store() + }) + + return stores +} + +export { validStore, useStores } diff --git a/packages/design-core/src/previewReact/src/srcFiles/utils.js b/packages/design-core/src/previewReact/src/srcFiles/utils.js new file mode 100644 index 000000000..b51178395 --- /dev/null +++ b/packages/design-core/src/previewReact/src/srcFiles/utils.js @@ -0,0 +1,14 @@ +/** +* Copyright (c) 2023 - present TinyEngine Authors. +* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. +* +* Use of this source code is governed by an MIT-style license. +* +* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, +* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR +* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. +* +*/ + +import { Pager, Select, Modal, Input } from '@opentiny/vue' +export { Pager, Select, Modal, Input } diff --git a/packages/design-core/src/previewReact/vite.config.js b/packages/design-core/src/previewReact/vite.config.js new file mode 100644 index 000000000..8b0f57b91 --- /dev/null +++ b/packages/design-core/src/previewReact/vite.config.js @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +// https://vite.dev/config/ +export default defineConfig({ + plugins: [react()], +}) diff --git a/packages/http/package.json b/packages/http/package.json index e242547fa..d29ed81ca 100644 --- a/packages/http/package.json +++ b/packages/http/package.json @@ -1,6 +1,6 @@ { "name": "@opentiny/tiny-engine-http", - "version": "1.0.5", + "version": "1.0.2", "publishConfig": { "access": "public" }, diff --git a/packages/i18n/package.json b/packages/i18n/package.json index 6f217c7c8..445cf8fe2 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -1,6 +1,6 @@ { "name": "@opentiny/tiny-engine-i18n-host", - "version": "1.0.6", + "version": "1.0.3", "publishConfig": { "access": "public" }, diff --git a/packages/plugins/block/package.json b/packages/plugins/block/package.json index eecc07ca4..f72f2f6e9 100644 --- a/packages/plugins/block/package.json +++ b/packages/plugins/block/package.json @@ -1,6 +1,6 @@ { "name": "@opentiny/tiny-engine-plugin-block", - "version": "1.0.6", + "version": "1.0.3", "publishConfig": { "access": "public" }, diff --git a/packages/plugins/block/src/BlockSetting.vue b/packages/plugins/block/src/BlockSetting.vue index ee2eeb029..0860091a7 100644 --- a/packages/plugins/block/src/BlockSetting.vue +++ b/packages/plugins/block/src/BlockSetting.vue @@ -78,7 +78,7 @@ + + + \ No newline at end of file diff --git a/packages/react-generator/src/templates/react-templates/template-files/packageJson.js b/packages/react-generator/src/templates/react-templates/template-files/packageJson.js new file mode 100644 index 000000000..3118cae0b --- /dev/null +++ b/packages/react-generator/src/templates/react-templates/template-files/packageJson.js @@ -0,0 +1,33 @@ +// 这里 package.json 格式设置为 js,避免被识别成一个 package +export default (schema) => { + const packageName = schema?.meta?.name || '@opentiny/tiny-engine-preview-react' + + const res = { + name: packageName, + version: '1.0.0', + scripts: { + dev: 'vite', + build: 'vite build', + preview: 'vite preview' + }, + main: 'dist/index.js', + module: 'dist/index.js', + dependencies: { + '@opentiny/tiny-engine-i18n-host': '^1.0.0', + '@opentiny/react': 'latest', + '@opentiny/react-icon': 'latest', + axios: 'latest', + antd: 'latest', + 'axios-mock-adapter': '^1.19.0', + react: '^18.3.1', + 'react-dom': '^18.3.1', + 'react-router-dom': '^6.27.0', + '@vitejs/plugin-react': 'latest' + }, + devDependencies: { + vite: '^4.3.7' + } + } + + return JSON.stringify(res) +} diff --git a/packages/react-generator/src/templates/react-templates/template-files/src/App.jsx b/packages/react-generator/src/templates/react-templates/template-files/src/App.jsx new file mode 100644 index 000000000..33a957af6 --- /dev/null +++ b/packages/react-generator/src/templates/react-templates/template-files/src/App.jsx @@ -0,0 +1,11 @@ +import { Routers } from './router' + +function App() { + return ( + <> + + + ) +} + +export default App diff --git a/packages/react-generator/src/templates/react-templates/template-files/src/hooks/useLazy.jsx b/packages/react-generator/src/templates/react-templates/template-files/src/hooks/useLazy.jsx new file mode 100644 index 000000000..140d54be2 --- /dev/null +++ b/packages/react-generator/src/templates/react-templates/template-files/src/hooks/useLazy.jsx @@ -0,0 +1,10 @@ +import { lazy, Suspense } from 'react' + +export const useLazy = (Component) => { + const Lazy = lazy(() => Component) + return (props) => ( + + + + ) +} diff --git a/packages/react-generator/src/templates/react-templates/template-files/src/http/axios.js b/packages/react-generator/src/templates/react-templates/template-files/src/http/axios.js new file mode 100644 index 000000000..4b2d6e420 --- /dev/null +++ b/packages/react-generator/src/templates/react-templates/template-files/src/http/axios.js @@ -0,0 +1,139 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +import axios from 'axios' +import MockAdapter from 'axios-mock-adapter' + +export default (config) => { + const instance = axios.create(config) + const defaults = {} + let mock + + if (typeof MockAdapter.prototype.proxy === 'undefined') { + MockAdapter.prototype.proxy = function ({ url, config = {}, proxy, response, handleData } = {}) { + let stream = this + const request = (proxy, any) => { + return (setting) => { + return new Promise((resolve) => { + config.responseType = 'json' + axios + .get(any ? proxy + setting.url + '.json' : proxy, config) + .then(({ data }) => { + /* eslint-disable no-useless-call */ + typeof handleData === 'function' && (data = handleData.call(null, data, setting)) + resolve([200, data]) + }) + .catch((error) => { + resolve([error.response.status, error.response.data]) + }) + }) + } + } + + if (url === '*' && proxy && typeof proxy === 'string') { + stream = proxy === '*' ? this.onAny().passThrough() : this.onAny().reply(request(proxy, true)) + } else { + if (proxy && typeof proxy === 'string') { + stream = this.onAny(url).reply(request(proxy)) + } else if (typeof response === 'function') { + stream = this.onAny(url).reply(response) + } + } + + return stream + } + } + + return { + request(config) { + return instance(config) + }, + get(url, config) { + return instance.get(url, config) + }, + delete(url, config) { + return instance.delete(url, config) + }, + head(url, config) { + return instance.head(url, config) + }, + post(url, data, config) { + return instance.post(url, data, config) + }, + put(url, data, config) { + return instance.put(url, data, config) + }, + patch(url, data, config) { + return instance.patch(url, data, config) + }, + all(iterable) { + return axios.all(iterable) + }, + spread(callback) { + return axios.spread(callback) + }, + defaults(key, value) { + if (key && typeof key === 'string') { + if (typeof value === 'undefined') { + return instance.defaults[key] + } + instance.defaults[key] = value + defaults[key] = value + } else { + return instance.defaults + } + }, + defaultSettings() { + return defaults + }, + interceptors: { + request: { + use(fnHandle, fnError) { + return instance.interceptors.request.use(fnHandle, fnError) + }, + eject(id) { + return instance.interceptors.request.eject(id) + } + }, + response: { + use(fnHandle, fnError) { + return instance.interceptors.response.use(fnHandle, fnError) + }, + eject(id) { + return instance.interceptors.response.eject(id) + } + } + }, + mock(config) { + if (!mock) { + mock = new MockAdapter(instance) + } + + if (Array.isArray(config)) { + config.forEach((item) => { + mock.proxy(item) + }) + } + + return mock + }, + disableMock() { + mock && mock.restore() + mock = undefined + }, + isMock() { + return typeof mock !== 'undefined' + }, + CancelToken: axios.CancelToken, + isCancel: axios.isCancel + } +} diff --git a/packages/react-generator/src/templates/react-templates/template-files/src/http/config.js b/packages/react-generator/src/templates/react-templates/template-files/src/http/config.js new file mode 100644 index 000000000..cfa3714e1 --- /dev/null +++ b/packages/react-generator/src/templates/react-templates/template-files/src/http/config.js @@ -0,0 +1,15 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +export default { + withCredentials: false +} diff --git a/packages/react-generator/src/templates/react-templates/template-files/src/http/index.js b/packages/react-generator/src/templates/react-templates/template-files/src/http/index.js new file mode 100644 index 000000000..b0a08546a --- /dev/null +++ b/packages/react-generator/src/templates/react-templates/template-files/src/http/index.js @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +import axios from './axios' +import config from './config' + +export default (dataHandler) => { + const http = axios(config) + + http.interceptors.response.use(dataHandler, (error) => { + const response = error.response + if (response.status === 403 && response.headers && response.headers['x-login-url']) { + // TODO 处理无权限时,重新登录再发送请求 + } + }) + + return http +} diff --git a/packages/react-generator/src/templates/react-templates/template-files/src/index.js b/packages/react-generator/src/templates/react-templates/template-files/src/index.js new file mode 100644 index 000000000..23624ca72 --- /dev/null +++ b/packages/react-generator/src/templates/react-templates/template-files/src/index.js @@ -0,0 +1,12 @@ +import ReactDOM from 'react-dom/client' +import { BrowserRouter, Route, Routes } from 'react-router-dom' +import App from './App' + +const root = ReactDOM.createRoot(document.getElementById('root')) +root.render( + + + } /> + + +) diff --git a/packages/react-generator/src/templates/react-templates/template-files/src/lowcodeConfig/bridge.js b/packages/react-generator/src/templates/react-templates/template-files/src/lowcodeConfig/bridge.js new file mode 100644 index 000000000..7a19e4a11 --- /dev/null +++ b/packages/react-generator/src/templates/react-templates/template-files/src/lowcodeConfig/bridge.js @@ -0,0 +1,13 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +export default () => {} diff --git a/packages/react-generator/src/templates/react-templates/template-files/src/lowcodeConfig/dataSource.js b/packages/react-generator/src/templates/react-templates/template-files/src/lowcodeConfig/dataSource.js new file mode 100644 index 000000000..80e1e88e7 --- /dev/null +++ b/packages/react-generator/src/templates/react-templates/template-files/src/lowcodeConfig/dataSource.js @@ -0,0 +1,102 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +import useHttp from '../http' +import dataSources from './dataSource.json' + +const dataSourceMap = {} + +// 暂时使用 eval 解析 JSON 数据里的函数 +const createFn = (fnContent) => { + return (...args) => { + // eslint-disable-next-line no-eval + window.eval('var fn = ' + fnContent) + // eslint-disable-next-line no-undef + return fn.apply(this, args) + } +} + +const globalDataHandle = dataSources.dataHandler ? createFn(dataSources.dataHandler.value) : (res) => res + +const load = (http, options, dataSource, shouldFetch) => (params, customUrl) => { + // 如果没有配置远程请求,则直接返回静态数据,返回前可能会有全局数据处理 + if (!options) { + return globalDataHandle(dataSource.config.data) + } + + if (!shouldFetch()) { + return + } + + dataSource.status = 'loading' + + const { method, uri: url, params: defaultParams, timeout, headers } = options + const config = { method, url, headers, timeout } + + const data = params || defaultParams + + config.url = customUrl || config.url + + if (method.toLowerCase() === 'get') { + config.params = data + } else { + config.data = data + } + + return http.request(config) +} + +dataSources.list.forEach((config) => { + const http = useHttp(globalDataHandle) + const dataSource = { config } + + dataSourceMap[config.name] = dataSource + + const shouldFetch = config.shouldFetch?.value ? createFn(config.shouldFetch.value) : () => true + const willFetch = config.willFetch?.value ? createFn(config.willFetch.value) : (options) => options + + const dataHandler = (res) => { + const data = config.dataHandler?.value ? createFn(config.dataHandler.value)(res) : res + dataSource.status = 'loaded' + dataSource.data = data + return data + } + + const errorHandler = (error) => { + config.errorHandler?.value && createFn(config.errorHandler.value)(error) + dataSource.status = 'error' + dataSource.error = error + } + + http.interceptors.request.use(willFetch, errorHandler) + http.interceptors.response.use(dataHandler, errorHandler) + + if (import.meta.env.VITE_APP_MOCK === 'mock') { + http.mock([ + { + url: config.options?.uri, + response() { + return Promise.resolve([200, { data: config.data }]) + } + }, + { + url: '*', + proxy: '*' + } + ]) + } + + dataSource.status = 'init' + dataSource.load = load(http, config.options, dataSource, shouldFetch) +}) + +export default dataSourceMap diff --git a/packages/react-generator/src/templates/react-templates/template-files/src/lowcodeConfig/lowcode.js b/packages/react-generator/src/templates/react-templates/template-files/src/lowcodeConfig/lowcode.js new file mode 100644 index 000000000..29da8186b --- /dev/null +++ b/packages/react-generator/src/templates/react-templates/template-files/src/lowcodeConfig/lowcode.js @@ -0,0 +1,86 @@ +/** + * Copyright (c) 2023 - present TinyEngine Authors. + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. + * + * Use of this source code is governed by an MIT-style license. + * + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. + * + */ + +import { getCurrentInstance, nextTick, provide, inject } from 'vue' +import { useRouter, useRoute } from 'vue-router' +import { I18nInjectionKey } from 'vue-i18n' +import dataSourceMap from './dataSource' +import * as utils from '../utils' +import * as bridge from './bridge' +import { useStores } from './store' + +export const lowcodeWrap = (props, context) => { + const global = {} + const instance = getCurrentInstance() + const router = useRouter() + const route = useRoute() + const { t, locale } = inject(I18nInjectionKey).global + const emit = context.emit + const ref = (ref) => instance.refs[ref] + + const setState = (newState, callback) => { + Object.assign(global.state, newState) + nextTick(() => callback.apply(global)) + } + + const getLocale = () => locale.value + const setLocale = (val) => { + locale.value = val + } + + const location = () => window.location + const history = () => window.history + + Object.defineProperties(global, { + props: { get: () => props }, + emit: { get: () => emit }, + setState: { get: () => setState }, + router: { get: () => router }, + route: { get: () => route }, + i18n: { get: () => t }, + getLocale: { get: () => getLocale }, + setLocale: { get: () => setLocale }, + location: { get: location }, + history: { get: history }, + utils: { get: () => utils }, + bridge: { get: () => bridge }, + dataSourceMap: { get: () => dataSourceMap }, + $: { get: () => ref } + }) + + const wrap = (fn) => { + if (typeof fn === 'function') { + return (...args) => fn.apply(global, args) + } + + Object.entries(fn).forEach(([name, value]) => { + Object.defineProperty(global, name, { + get: () => value + }) + }) + + fn.t = t + + return fn + } + + return wrap +} + +export default () => { + const i18n = inject(I18nInjectionKey) + provide(I18nInjectionKey, i18n) + + const stores = useStores() + + return { t: i18n.global.t, lowcodeWrap, stores } +} diff --git a/packages/react-generator/src/templates/react-templates/template-files/src/lowcodeConfig/store.js b/packages/react-generator/src/templates/react-templates/template-files/src/lowcodeConfig/store.js new file mode 100644 index 000000000..f7f39c7a8 --- /dev/null +++ b/packages/react-generator/src/templates/react-templates/template-files/src/lowcodeConfig/store.js @@ -0,0 +1,13 @@ +import * as useDefinedStores from '@/stores' + +const useStores = () => { + const stores = {} + + Object.values({ ...useDefinedStores }).forEach((store) => { + stores[store.$id] = store() + }) + + return stores +} + +export { useStores } diff --git a/packages/react-generator/src/utils/formatCode.js b/packages/react-generator/src/utils/formatCode.js new file mode 100644 index 000000000..e69de29bb diff --git a/packages/react-generator/src/utils/generateImportStatement.js b/packages/react-generator/src/utils/generateImportStatement.js new file mode 100644 index 000000000..0601b54a7 --- /dev/null +++ b/packages/react-generator/src/utils/generateImportStatement.js @@ -0,0 +1,58 @@ +// TODO: 动态导入,暂时不考虑 +export function generateImportStatement(config) { + const { moduleName, exportName, alias, destructuring } = config + + let statementName = `${exportName}` + + if (alias && alias !== exportName) { + // 命令空间导入 + if (!exportName) { + statementName = `* as ${alias}` + } else { + statementName = `${exportName} as ${alias}` + } + } + + if (destructuring) { + statementName = `{ ${statementName} }` + } + + return `import ${statementName} from '${moduleName}'` +} + +// 含有多个配置项的时候 +export function generateImportByPkgName(config) { + const { pkgName, imports } = config + + const importStatements = imports + .filter(({ destructuring }) => destructuring) + .map(({ componentName, exportName }) => { + if (componentName === exportName) { + return componentName + } + + return `${exportName} as ${componentName}` + }) + + // 默认导出如果存在,应该只有一个 + let defaultImports = imports.find(({ destructuring }) => !destructuring) + let defaultImportStatement = '' + + if (defaultImports) { + const { componentName, exportName } = defaultImports + + if (exportName && exportName !== componentName) { + defaultImportStatement = `${exportName} as ${componentName}` + } else { + defaultImportStatement = `${exportName || componentName || ''}` + } + + defaultImportStatement = `import ${defaultImportStatement} from "${pkgName}"\n` + } + + if (!importStatements.length && defaultImportStatement) { + return defaultImportStatement + } + + return `${defaultImportStatement}import { ${importStatements.join(',')} } from "${pkgName}"` +} diff --git a/packages/react-generator/src/utils/hasJsx.js b/packages/react-generator/src/utils/hasJsx.js new file mode 100644 index 000000000..e270f3363 --- /dev/null +++ b/packages/react-generator/src/utils/hasJsx.js @@ -0,0 +1,25 @@ +import { parse } from '@babel/parser' +import traverse from '@babel/traverse' + +export function hasJsx(code) { + try { + const ast = parse(code, { plugins: ['jsx'] }) + let res = false + + traverse(ast, { + JSXElement(path) { + res = true + path.stop() + }, + JSXFragment(path) { + res = true + path.stop() + } + }) + + return res + } catch (error) { + // 解析失败则认为不存在 jsx + return false + } +} diff --git a/packages/react-generator/src/utils/mergeOptions.js b/packages/react-generator/src/utils/mergeOptions.js new file mode 100644 index 000000000..31314dbf6 --- /dev/null +++ b/packages/react-generator/src/utils/mergeOptions.js @@ -0,0 +1,30 @@ +function isObject(target) { + return Object.prototype.toString.call(target) === '[object Object]' +} + +// 合并对象 +export const mergeOptions = (originOptions, newOptions) => { + if (!isObject(originOptions) || !isObject(newOptions)) { + return originOptions + } + + const res = {} + + for (const [key, value] of Object.entries(originOptions)) { + if (!Object.prototype.hasOwnProperty.call(newOptions, key)) { + res[key] = value + } + + if (isObject(value) && isObject(newOptions[key])) { + res[key] = mergeOptions(value, newOptions[key]) + } + } + + for (const [key, value] of Object.entries(newOptions)) { + if (!Object.prototype.hasOwnProperty.call(res, key)) { + res[key] = value + } + } + + return res +} diff --git a/packages/react-generator/src/utils/parseRequiredBlocks.js b/packages/react-generator/src/utils/parseRequiredBlocks.js new file mode 100644 index 000000000..5819a3536 --- /dev/null +++ b/packages/react-generator/src/utils/parseRequiredBlocks.js @@ -0,0 +1,18 @@ +export const parseRequiredBlocks = (schema) => { + const res = [] + + if (!Array.isArray(schema?.children)) { + return res + } + + for (const item of schema.children) { + if (item.componentType === 'Block') { + res.push(item.componentName) + } + if (Array.isArray(item.children)) { + res.push(...parseRequiredBlocks(item)) + } + } + + return res +} diff --git a/packages/react-generator/src/utils/uaperCase.js b/packages/react-generator/src/utils/uaperCase.js new file mode 100644 index 000000000..56c845e7d --- /dev/null +++ b/packages/react-generator/src/utils/uaperCase.js @@ -0,0 +1,4 @@ +export const capitalizeFirstLetter = (string) => { + if (!string) return string // 检查空字符串 + return string.charAt(0).toUpperCase() + string.slice(1) +} diff --git a/packages/react-generator/test/testcases/full/case1_normal/input/components-map.json b/packages/react-generator/test/testcases/full/case1_normal/input/components-map.json index 41c01dd1f..c47f1805e 100644 --- a/packages/react-generator/test/testcases/full/case1_normal/input/components-map.json +++ b/packages/react-generator/test/testcases/full/case1_normal/input/components-map.json @@ -2,7 +2,7 @@ { "componentName": "TinyButton", "exportName": "Button", - "package": "@opentiny/vue", + "package": "@opentiny/react", "version": "^3.10.0", "destructuring": true }, @@ -25,4 +25,4 @@ "componentName": "CrmQuoteListGridStatus", "main": "./views/crm/quote-list" } -] +] \ No newline at end of file diff --git a/packages/react-generator/vite.config.js b/packages/react-generator/vite.config.js index 239a77557..4b2e1b6a5 100644 --- a/packages/react-generator/vite.config.js +++ b/packages/react-generator/vite.config.js @@ -12,6 +12,7 @@ import { defineConfig } from 'vite' import path from 'path' +import { viteStaticCopy } from 'vite-plugin-static-copy' // https://vitejs.dev/config/ export default defineConfig({ @@ -20,6 +21,29 @@ export default defineConfig({ entry: path.resolve(__dirname, './src/index.js'), formats: ['cjs', 'es'] }, - sourcemap: true + sourcemap: true, + rollupOptions: { + external: ['@babel/parser', '@babel/traverse'] + } + }, + plugins: [ + viteStaticCopy({ + targets: [ + { + src: './src/index.d.ts', + dest: '.' + } + ] + }) + ], + resolve: { + alias: { + '@': path.resolve(__dirname, './src') + }, + extensions: ['.js', '.ts'] + }, + test: { + exclude: ['**/result/**'], + watchExclude: ['**/result/**'] } }) diff --git a/packages/settings/design/package.json b/packages/settings/design/package.json index d6f51260b..63049b52e 100644 --- a/packages/settings/design/package.json +++ b/packages/settings/design/package.json @@ -1,6 +1,6 @@ { "name": "@opentiny/tiny-engine-setting-design", - "version": "1.0.6", + "version": "1.0.3", "publishConfig": { "access": "public" }, diff --git a/packages/settings/events/package.json b/packages/settings/events/package.json index d0fa09793..7272f190b 100644 --- a/packages/settings/events/package.json +++ b/packages/settings/events/package.json @@ -1,6 +1,6 @@ { "name": "@opentiny/tiny-engine-setting-events", - "version": "1.0.6", + "version": "1.0.3", "publishConfig": { "access": "public" }, diff --git a/packages/settings/events/src/components/BindEvents.vue b/packages/settings/events/src/components/BindEvents.vue index 49ac91904..aa8550f25 100644 --- a/packages/settings/events/src/components/BindEvents.vue +++ b/packages/settings/events/src/components/BindEvents.vue @@ -28,12 +28,12 @@ @@ -43,7 +43,7 @@
- {{ action.eventName }}{{ renderEventList[action.eventName]?.label?.[locale] }} + {{ action.eventName }}{{ state.componentEvents[action.eventName].label.zh_CN }}
{{ action.linkedEventName }}
{{ action.ref }} @@ -78,7 +78,7 @@ @@ -88,7 +88,6 @@ import { computed, reactive, watchEffect } from 'vue' import { Popover, Button } from '@opentiny/vue' import { useCanvas, useModal, useLayout, useBlock, useResource } from '@opentiny/tiny-engine-controller' -import i18n from '@opentiny/tiny-engine-controller/js/i18n' import { BlockLinkEvent, SvgButton } from '@opentiny/tiny-engine-common' import { iconHelpQuery, iconChevronDown } from '@opentiny/vue-icon' import BindEventsDialog, { open as openDialog } from './BindEventsDialog.vue' @@ -113,7 +112,6 @@ export default { const { getBlockEvents, getCurrentBlock, removeEventLink } = useBlock() const { getMaterial } = useResource() const { confirm } = useModal() - const locale = i18n.global.locale.value const { highlightMethod } = getPluginApi(PLUGIN_NAME.PageController) @@ -121,25 +119,25 @@ export default { eventName: '', // 事件名称 eventBinding: null, // 事件绑定的处理方法对象 componentEvent: {}, - customEvents: commonEvents, + componentEvents: commonEvents, bindActions: {}, showBindEventDialog: false }) const isBlock = computed(() => Boolean(pageState.isBlock)) const isEmpty = computed(() => Object.keys(state.bindActions).length === 0) - const renderEventList = computed(() => ({ ...state.componentEvent, ...state.customEvents })) watchEffect(() => { const componentName = pageState?.currentSchema?.componentName const componentSchema = getMaterial(componentName) state.componentEvent = componentSchema?.content?.schema?.events || componentSchema?.schema?.events || {} + Object.assign(state.componentEvents, state.componentEvent) const props = pageState?.currentSchema?.props || {} const keys = Object.keys(props) state.bindActions = {} // 遍历组件事件元数据 - Object.entries(renderEventList.value).forEach(([eventName, componentEvent]) => { + Object.entries(state.componentEvents).forEach(([eventName, componentEvent]) => { // 查找组件已添加的事件 if (keys.indexOf(eventName) > -1) { const event = props[eventName] @@ -227,7 +225,7 @@ export default { const handleAddEvent = (params) => { const { eventName, eventDescription } = params - Object.assign(state.customEvents, { + Object.assign(state.componentEvents, { [eventName]: { label: { zh_CN: eventDescription @@ -255,9 +253,7 @@ export default { openCodePanel, openActionDialog, handleAddEvent, - handleToggleAddEventDialog, - renderEventList, - locale + handleToggleAddEventDialog } } } diff --git a/packages/settings/events/src/components/BindEventsDialog.vue b/packages/settings/events/src/components/BindEventsDialog.vue index 079f2e8d2..e7fbc838e 100644 --- a/packages/settings/events/src/components/BindEventsDialog.vue +++ b/packages/settings/events/src/components/BindEventsDialog.vue @@ -1,6 +1,6 @@