diff --git a/.eslintignore b/.eslintignore index a5f9925b3..997d732c1 100644 --- a/.eslintignore +++ b/.eslintignore @@ -5,3 +5,5 @@ package-lock.json **/node_modules/** tmp temp +mockServer +packages/vue-generator/**/output/** diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 74fb168b1..f4e2f220c 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,3 +1,5 @@ +English | [简体中文](https://github.com/opentiny/tiny-engine/blob/develop/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.zh-CN.md) + # PR ## PR Checklist @@ -7,6 +9,7 @@ Please check if your PR fulfills the following requirements: - [ ] The commit message follows our [Commit Message Guidelines](https://github.com/opentiny/tiny-engine/blob/develop/CONTRIBUTING.md) - [ ] Tests for the changes have been added (for bug fixes / features) - [ ] Docs have been added / updated (for bug fixes / features) +- [ ] Built its own designer, fully self-validated ## PR Type @@ -23,13 +26,21 @@ What kind of change does this PR introduce? - [ ] Documentation content changes - [ ] Other... Please describe: -## What is the current behavior? +## Background and solution + + +### What is the current behavior? Issue Number: N/A -## What is the new behavior? +### What is the new behavior? + ## Does this PR introduce a breaking change? diff --git a/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.zh-CN.md b/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.zh-CN.md new file mode 100644 index 000000000..6ceff4df4 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.zh-CN.md @@ -0,0 +1,52 @@ +[English](https://github.com/opentiny/tiny-engine/blob/develop/.github/PULL_REQUEST_TEMPLATE.md) | 简体中文 + +# PR + +## PR Checklist + +请检查您的 PR 是否满足以下要求: + +- [ ] commit message遵循我们的[提交贡献指南](https://github.com/opentiny/tiny-engine/blob/develop/CONTRIBUTING.md) +- [ ] 添加了更改内容的测试用例(用于bugfix/功能) +- [ ] 文档已添加/更新(用于bugfix/功能) +- [ ] 是否构建了自己的设计器,经过了充分的自验证 + +## PR 类型 + +这个PR的类型是? + +- [ ] 日常 bug 修复 +- [ ] 新特性支持 +- [ ] 代码风格优化 +- [ ] 重构 +- [ ] 构建优化 +- [ ] 测试用例 +- [ ] 文档更新 +- [ ] 分支合并 +- [ ] 其他改动(请补充) + + +## 需求背景和解决方案 + + + + +Issue Number: N/A + +### 修改前 + + +### 修改后 + +## 此PR是否含有 breaking change? + +- [ ] 是 +- [ ] 否 + + + +## Other information diff --git a/.github/workflows/push-check.yml b/.github/workflows/push-check.yml new file mode 100644 index 000000000..7f0d4ed41 --- /dev/null +++ b/.github/workflows/push-check.yml @@ -0,0 +1,36 @@ +name: Push And Create PR Check + +on: + push: + branches: [] + pull_request: + branches: [develop,main] + +jobs: + push-check: + runs-on: ubuntu-latest # windows-latest || macos-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 16 + + - name: Install pnpm + run: npm i -g pnpm + + - name: Install dependencies + run: pnpm i + + - name: Get changed files + id: get_changed_files + uses: tj-actions/changed-files@v40 + with: + files: | + **.js + **.vue + **.jsx + - name: Run ESLint + run: npx eslint ${{steps.get_changed_files.outputs.all_changed_files}} + - name: Run Build + run: pnpm run build:plugin && pnpm run build:alpha diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4a462f49c..3070a8cce 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,14 +51,11 @@ Local startup steps: git clone git@github.com:username/tiny-engine.git cd tiny-engine git remote add upstream git@github.com:opentiny/tiny-engine.git -npm i +pnpm i # Start the project. -$ npm run serve +$ pnpm dev -# start another terminal -$ cd mockServer -$ npm run dev ``` To submit a PR: @@ -67,7 +64,7 @@ To submit a PR: - Local coding. - Submit according to [Commit Message Format](https://www.conventionalcommits.org/zh-hans/v1.0.0/) specification. PR that do not conform to the submission specification will not be merged. - Submit to remote repository: `git push origin branchName`. -- (Optional) Synchronize upstream repository dev branch latest code: `git pull upstream dev`. +- (Optional) Synchronize upstream repository dev branch latest code: `git pull upstream develop`. - Open the [Pull requests](https://github.com/opentiny/tiny-engine/pulls) link of the TinyEngine code repository and click the New pull request button to submit the PR. - Project Committer conducts Code Review and makes comments. - The PR author adjusts the code according to the opinion. Please note that when a branch initiates PR, the subsequent commit will be synchronized automatically, and there is no need to resubmit the PR. diff --git a/CONTRIBUTING.zh-CN.md b/CONTRIBUTING.zh-CN.md index 171f91b22..6729ec585 100644 --- a/CONTRIBUTING.zh-CN.md +++ b/CONTRIBUTING.zh-CN.md @@ -42,23 +42,18 @@ - 点击 [TinyEngine](https://github.com/opentiny/tiny-engine) 代码仓库右上角的 Fork 按钮,将上游仓库 Fork 到个人仓库 - Clone 个人仓库到本地 -- 在 TinyEngine 根目录下运行 `npm install`, 安装依赖 -- 在 TinyEngine mockServer 运行 `npm install`, 安装依赖 -- 在 TinyEngine 根目录下运行 `npm run serve`,再到 mockServer 目录下运行 `npm run dev`,启动本地开发 +- 在 TinyEngine 根目录下运行 `pnpm i`, 安装依赖 +- 在 TinyEngine 根目录下运行 `pnpm dev`,启动本地开发 ```shell # username 为用户名,执行前请替换 git clone git@github.com:username/tiny-engine.git cd tiny-engine git remote add upstream git@github.com:opentiny/tiny-engine.git -npm i +pnpm i # 启动项目 -$ npm run serve - -# start another terminal -$ cd mockServer -$ npm run dev +$ pnpm dev ``` @@ -68,7 +63,7 @@ $ npm run dev - 本地编码 - 遵循 Commit Message Format 规范进行提交,不符合提交规范的 PR 将不会被合并 - 提交到远程仓库:git push origin branchName -- (可选)同步上游仓库 dev 分支最新代码:git pull upstream dev +- (可选)同步上游仓库 develop 分支最新代码:git pull upstream develop - 打开 TinyEngine 代码仓库的 [Pull requests](https://github.com/opentiny/tiny-engine/pulls) 链接,点击 New pull request 按钮提交 PR - 项目 Committer 进行 Code Review,并提出意见 - PR 作者根据意见调整代码,请注意一个分支发起了 PR 后,后续的 commit 会自动同步,无需重新提交 PR @@ -81,4 +76,4 @@ $ npm run dev 如果你对我们的开源项目感兴趣,欢迎通过以下方式加入我们的开源社区。 - 添加官方小助手微信:opentiny-official,加入我们的技术交流群 -- 加入邮件列表:opentiny@googlegroups.com +- 加入邮件列表:opentiny@googlegroups.com \ No newline at end of file diff --git a/README.en-US.md b/README.en-US.md deleted file mode 100644 index 4f395514d..000000000 --- a/README.en-US.md +++ /dev/null @@ -1,64 +0,0 @@ -

- - OpenTiny Logo - -

- -

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.

- -English | [简体中文](README.zh-CN.md) - -🌈 Features: - -- Cross-end cross-frame front-end components -- Supports online real-time construction, secondary development, or being integrated. -- Directly generate deployable source code without engine support. -- Allows access to third-party components and customized extension plug-ins. -- Supports high-code and low-code, and hybrid development and deployment of applications. -- The platform accesses AI big model capabilities to help developers build applications. - -## Development - -### Dependencies required for installation - -```sh -$ pnpm install -``` - -### Local development: Start the local mock server and use the mock data of the local mock server. - -```sh -$ pnpm dev -``` - -Open a browser: `http://localhost:8080/?type=app&id=918&tenant=1&pageid=NTJ4MjvqoVj8OVsc` -`url search` Parameters: - -- `type=app` Application type -- `id=xxx` Application ID -- `tenant=xxx` Organization ID -- `pageid=xxx` Page ID - -## Build - -```sh -# Build all plug-ins first -pnpm build:plugin - -# Build Designer -pnpm build:alpha or build:prod - -``` - -## 🤝 Participation and Contribution - -If you are interested in our open source project, please join us! 🎉 - -Please read the [Contribution Guide](CONTRIBUTING.md) before participating in the contribution. - -- Add official assistant WeChat opentiny-official and join the technical exchange group -- Join the mailing list opentiny@googlegroups.com - -## License - -[MIT](LICENSE) diff --git a/README.md b/README.md index 4f395514d..c5d21f1a6 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,12 @@ English | [简体中文](README.zh-CN.md) - Supports high-code and low-code, and hybrid development and deployment of applications. - The platform accesses AI big model capabilities to help developers build applications. +## Documentation + +- intro:https://opentiny.design/tiny-engine#/home +- tutorial:https://opentiny.design/tiny-engine#/help-center/course/engine +- playground:https://opentiny.design/tiny-engine#/tiny-engine-editor + ## Development ### Dependencies required for installation @@ -50,6 +56,19 @@ pnpm build:alpha or build:prod ``` +## Milestones + +```mermaid +gantt +dateFormat YYYY-MM-DD +axisFormat %Y-%m-%d + + 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 + +``` + ## 🤝 Participation and Contribution If you are interested in our open source project, please join us! 🎉 diff --git a/README.zh-CN.md b/README.zh-CN.md index 60f3d1f3f..4ab41b55a 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -17,6 +17,12 @@ - 支持高代码与低代码,混合开发部署应用 - 平台接入 AI 大模型能力,辅助开发者构建应用 +## 文档 + +- 介绍:https://opentiny.design/tiny-engine#/home +- 使用文档:https://opentiny.design/tiny-engine#/help-center/course/engine +- 演示应用:https://opentiny.design/tiny-engine#/tiny-engine-editor + ## 开发 ### 安装所需的依赖 @@ -50,6 +56,19 @@ pnpm run build:alpha 或 build:prod ``` +## 里程碑 + +```mermaid +gantt +dateFormat YYYY-MM-DD +axisFormat %Y-%m-%d + + 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 39aa2edab..53e074838 100644 --- a/mockServer/package.json +++ b/mockServer/package.json @@ -5,8 +5,17 @@ "access": "public" }, "description": "mock服务", - "author": "opentiny", - "license": "WTFPL", + "repository": { + "type": "git", + "url": "https://github.com/opentiny/tiny-engine", + "directory": "mockServer" + }, + "bugs": { + "url": "https://github.com/opentiny/tiny-engine/issues" + }, + "author": "OpenTiny Team", + "license": "MIT", + "homepage": "https://opentiny.design/tiny-engine", "scripts": { "start": "gulp nodemon", "dev": "gulp", diff --git a/package.json b/package.json index 7829e7b22..365ca8e21 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "private": true, "scripts": { "preinstall": "npx only-allow pnpm", - "dev": "concurrently 'pnpm:serve:backend' 'pnpm:serve:frontend'", + "dev": "pnpm run setup && concurrently 'pnpm:serve:backend' 'pnpm:serve:frontend'", "dev:mock": "pnpm --filter @opentiny/tiny-engine dev", "serve:frontend": "pnpm --filter @opentiny/tiny-engine serve", "serve:backend": "pnpm --filter @opentiny/tiny-engine-mock dev", @@ -18,7 +18,8 @@ "pub:premajor": "pnpm run build:plugin && pnpm run build:alpha && pnpm lerna version premajor --preid beta --no-push --yes && lerna publish from-package --pre-dist-tag beta --yes", "pub:preminor": "pnpm run build:plugin && pnpm run build:alpha && pnpm lerna version preminor --preid beta --no-push --yes && lerna publish from-package --pre-dist-tag beta --yes", "pub:prepatch": "pnpm run build:plugin && pnpm run build:alpha && pnpm lerna version prepatch --preid beta --no-push --yes && lerna publish from-package --pre-dist-tag beta --yes", - "pub:prerelease": "pnpm run build:plugin && pnpm run build:alpha && pnpm lerna version prerelease --preid beta --no-push --yes && lerna publish from-package --pre-dist-tag beta --yes" + "pub:prerelease": "pnpm run build:plugin && pnpm run build:alpha && pnpm lerna version prerelease --preid beta --no-push --yes && lerna publish from-package --pre-dist-tag beta --yes", + "setup": "node ./scripts/setup.js" }, "devDependencies": { "@babel/eslint-parser": "^7.21.3", diff --git a/packages/builtinComponent/README.md b/packages/builtinComponent/README.md new file mode 100644 index 000000000..5670a81d8 --- /dev/null +++ b/packages/builtinComponent/README.md @@ -0,0 +1,9 @@ +# 内置组件 + +## 目前内置的组件 + +### CanvasRow + +### CanvasCol + +### CanvasRowColContainer diff --git a/packages/builtinComponent/index.js b/packages/builtinComponent/index.js new file mode 100644 index 000000000..99242b77a --- /dev/null +++ b/packages/builtinComponent/index.js @@ -0,0 +1,4 @@ +export { default as CanvasCol } from './src/components/CanvasCol.vue' +export { default as CanvasRow } from './src/components/CanvasRow.vue' +export { default as CanvasRowColContainer } from './src/components/CanvasRowColContainer.vue' +export { default as meta } from './src/meta' diff --git a/packages/builtinComponent/package.json b/packages/builtinComponent/package.json new file mode 100644 index 000000000..9ca16bed9 --- /dev/null +++ b/packages/builtinComponent/package.json @@ -0,0 +1,26 @@ +{ + "name": "@opentiny/tiny-engine-builtin-component", + "version": "0.1.0", + "description": "", + "main": "dist/index.js", + "module": "dist/index.js", + "files": [ + "dist" + ], + "repository": { + "type": "git", + "url": "https://github.com/opentiny/tiny-engine", + "directory": "packages/builtinComponent" + }, + "scripts": { + "build": "vite build" + }, + "dependencies": { + "@opentiny/vue": "~3.10.0" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^4.2.3", + "@vitejs/plugin-vue-jsx": "^3.0.2", + "vite": "^4.5.0" + } +} diff --git a/packages/builtinComponent/src/components/CanvasCol.vue b/packages/builtinComponent/src/components/CanvasCol.vue new file mode 100644 index 000000000..7bbaeb4be --- /dev/null +++ b/packages/builtinComponent/src/components/CanvasCol.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/packages/builtinComponent/src/components/CanvasRow.vue b/packages/builtinComponent/src/components/CanvasRow.vue new file mode 100644 index 000000000..5c7ba54d5 --- /dev/null +++ b/packages/builtinComponent/src/components/CanvasRow.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/packages/builtinComponent/src/components/CanvasRowColContainer.vue b/packages/builtinComponent/src/components/CanvasRowColContainer.vue new file mode 100644 index 000000000..ad46e409d --- /dev/null +++ b/packages/builtinComponent/src/components/CanvasRowColContainer.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/packages/builtinComponent/src/components/helper.js b/packages/builtinComponent/src/components/helper.js new file mode 100644 index 000000000..59200272e --- /dev/null +++ b/packages/builtinComponent/src/components/helper.js @@ -0,0 +1,46 @@ +/** + * 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 getStyleValue = (value) => { + if (typeof value === 'number' || /^\d+\.?\d*$/.test(value)) { + return `${value}px` + } + + if (/^\d+\.?\d*(px|%|pt|em|rem|vw|vh)$/.test(value)) { + return value + } + + return '' +} + +export const alignMap = { + 'flex-start': 'flex-start', + 'flex-end': 'flex-end', + center: 'center', + stretch: 'stretch', + start: 'start', + end: 'end' +} + +export const justAlignMap = { + 'space-between': 'space-between', + 'space-around': 'space-around', + 'space-evenly': 'space-evenly', + 'flex-start': 'flex-start', + 'flex-end': 'flex-end', + stretch: 'stretch', + center: 'center', + start: 'start', + end: 'end', + left: 'left', + right: 'right' +} diff --git a/packages/builtinComponent/src/meta/CanvasCol.json b/packages/builtinComponent/src/meta/CanvasCol.json new file mode 100644 index 000000000..33c68b5df --- /dev/null +++ b/packages/builtinComponent/src/meta/CanvasCol.json @@ -0,0 +1,196 @@ +{ + "components": { + "icon": "Box", + "name": { + "zh_CN": "CanvasCol" + }, + "component": "CanvasCol", + "schema": { + "slots": {}, + "properties": [ + { + "label": { + "zh_CN": "基础信息" + }, + "description": { + "zh_CN": "基础信息" + }, + "collapse": { + "number": 6, + "text": { + "zh_CN": "显示更多" + } + }, + "content": [ + { + "property": "widthType", + "type": "String", + "defaultValue": "auto", + "label": { + "text": { + "zh_CN": "宽度类型" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaRadioGroup", + "props": { + "options": [ + { "label": "auto", "text": "自适应" }, + { "label": "fixed", "text": "固定" } + ], + "type": "button" + } + } + }, + { + "property": "flexBasis", + "type": "String", + "defaultValue": "", + "label": { + "text": { + "zh_CN": "固定宽度" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaInput", + "props": {} + } + }, + { + "property": "rowGap", + "type": "String", + "defaultValue": "", + "label": { + "text": { + "zh_CN": "行间距" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaInput", + "props": {} + } + }, + { + "property": "colGap", + "type": "String", + "defaultValue": "", + "label": { + "text": { + "zh_CN": "列间距" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaInput", + "props": {} + } + }, + { + "property": "align", + "type": "String", + "defaultValue": "", + "label": { + "text": { + "zh_CN": "副轴对齐" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaSelect", + "props": { + "options": [ + { "value": "flex-start", "label": "头部对齐" }, + { "value": "center", "label": "中间对齐" }, + { "value": "flex-end", "label": "尾端对齐" }, + { "value": "stretch", "label": "拉伸对齐" } + ], + "type": "button" + } + } + }, + { + "property": "justAlign", + "type": "String", + "defaultValue": "", + "label": { + "text": { + "zh_CN": "主轴对齐" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaSelect", + "props": { + "options": [ + { "value": "flex-start", "label": "头部对齐" }, + { "value": "center", "label": "中间对齐" }, + { "value": "flex-end", "label": "尾端对齐" }, + { "value": "space-between", "label": "两端对齐" }, + { "value": "space-evenly", "label": "均分对齐" } + ], + "type": "button" + } + } + }, + { + "property": "grow", + "type": "String", + "defaultValue": "", + "label": { + "text": { + "zh_CN": "增长" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaSwitch", + "props": {} + } + }, + { + "property": "shrink", + "type": "String", + "defaultValue": "", + "label": { + "text": { + "zh_CN": "收缩" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaSwitch", + "props": {} + } + } + ] + } + ], + "events": {}, + "shortcuts": { + "properties": [] + }, + "contentMenu": { + "actions": [] + } + }, + "configure": { + "loop": true, + "isContainer": true, + "nestingRule": { + "childWhitelist": [], + "descendantBlacklist": [] + } + } + } +} diff --git a/packages/builtinComponent/src/meta/CanvasRow.json b/packages/builtinComponent/src/meta/CanvasRow.json new file mode 100644 index 000000000..5033b30ba --- /dev/null +++ b/packages/builtinComponent/src/meta/CanvasRow.json @@ -0,0 +1,142 @@ +{ + "components": { + "icon": "Box", + "name": { + "zh_CN": "CanvasRow" + }, + "component": "CanvasRow", + "schema": { + "slots": {}, + "properties": [ + { + "label": { + "zh_CN": "基础信息" + }, + "description": { + "zh_CN": "基础信息" + }, + "collapse": { + "number": 6, + "text": { + "zh_CN": "显示更多" + } + }, + "content": [ + { + "property": "minHeight", + "type": "String", + "defaultValue": "", + "label": { + "text": { + "zh_CN": "最小高度" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaInput", + "props": {} + } + }, + { + "property": "rowGap", + "type": "String", + "defaultValue": "", + "label": { + "text": { + "zh_CN": "行间距" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaInput", + "props": {} + } + }, + { + "property": "colGap", + "type": "String", + "defaultValue": "", + "label": { + "text": { + "zh_CN": "列间距" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaInput", + "props": {} + } + }, + { + "property": "align", + "type": "String", + "defaultValue": "", + "label": { + "text": { + "zh_CN": "副轴对齐" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaSelect", + "props": { + "options": [ + { "value": "flex-start", "label": "头部对齐" }, + { "value": "center", "label": "中间对齐" }, + { "value": "flex-end", "label": "尾端对齐" }, + { "value": "stretch", "label": "拉伸对齐" } + ], + "type": "button" + } + } + }, + { + "property": "justAlign", + "type": "String", + "defaultValue": "", + "label": { + "text": { + "zh_CN": "主轴对齐" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaSelect", + "props": { + "options": [ + { "value": "flex-start", "label": "头部对齐" }, + { "value": "center", "label": "中间对齐" }, + { "value": "flex-end", "label": "尾端对齐" }, + { "value": "space-between", "label": "两端对齐" }, + { "value": "space-evenly", "label": "均分对齐" } + ], + "type": "button" + } + } + } + ] + } + ], + "events": {}, + "shortcuts": { + "properties": [] + }, + "contentMenu": { + "actions": [] + } + }, + "configure": { + "loop": true, + "isContainer": true, + "nestingRule": { + "childWhitelist": [], + "descendantBlacklist": [] + } + } + } +} diff --git a/packages/builtinComponent/src/meta/CanvasRowColContainer.json b/packages/builtinComponent/src/meta/CanvasRowColContainer.json new file mode 100644 index 000000000..e363530f6 --- /dev/null +++ b/packages/builtinComponent/src/meta/CanvasRowColContainer.json @@ -0,0 +1,96 @@ +{ + "components": { + "icon": "Box", + "name": { + "zh_CN": "行列容器" + }, + "component": "CanvasRowColContainer", + "schema": { + "slots": {}, + "properties": [ + { + "label": { + "zh_CN": "基础信息" + }, + "description": { + "zh_CN": "基础信息" + }, + "collapse": { + "number": 6, + "text": { + "zh_CN": "显示更多" + } + }, + "content": [ + { + "property": "rowGap", + "type": "String", + "defaultValue": "", + "label": { + "text": { + "zh_CN": "行间距" + } + }, + "cols": 12, + "rules": [], + "widget": { + "component": "MetaInput", + "props": {} + } + } + ] + } + ], + "events": {}, + "shortcuts": { + "properties": [] + }, + "contentMenu": { + "actions": [] + } + }, + "configure": { + "loop": true, + "isContainer": true, + "nestingRule": { + "childWhitelist": [], + "descendantBlacklist": [] + } + } + }, + "snippets": { + "name": { + "zh_CN": "行列容器" + }, + "screenshot": "", + "snippetName": "CanvasRowColContainer", + "icon": "Box", + "schema": { + "componentName": "CanvasRowColContainer", + "props": { + "rowGap": "20px" + }, + "children": [ + { + "componentName": "CanvasRow", + "props": { + "rowGap": "20px", + "colGap": "20px" + }, + "children": [ + { + "componentName": "CanvasCol", + "props": { + "rowGap": "20px", + "colGap": "20px", + "grow": true, + "shrink": true, + "widthType": "auto" + } + } + ] + } + ] + } + } +} diff --git a/packages/builtinComponent/src/meta/index.js b/packages/builtinComponent/src/meta/index.js new file mode 100644 index 000000000..fa2fca60d --- /dev/null +++ b/packages/builtinComponent/src/meta/index.js @@ -0,0 +1,18 @@ +import CanvasCol from './CanvasCol.json' +import CanvasRow from './CanvasRow.json' +import CanvasRowColContainer from './CanvasRowColContainer.json' + +export default { + components: [ + { + group: '内置组件', + children: [{ ...CanvasCol.components }, { ...CanvasRow.components }, { ...CanvasRowColContainer.components }] + } + ], + snippets: [ + { + group: '内置组件', + children: [{ ...CanvasRowColContainer.snippets }] + } + ] +} diff --git a/packages/builtinComponent/vite.config.js b/packages/builtinComponent/vite.config.js new file mode 100644 index 000000000..62ca318c0 --- /dev/null +++ b/packages/builtinComponent/vite.config.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 { defineConfig } from 'vite' +import path from 'path' +import vue from '@vitejs/plugin-vue' +import vueJsx from '@vitejs/plugin-vue-jsx' + +export default defineConfig({ + plugins: [vue(), vueJsx()], + publicDir: false, + build: { + cssCodeSplit: false, + lib: { + entry: path.resolve(__dirname, './index.js'), + name: 'builtinComponent', + fileName: () => 'index.js', + formats: ['es'] + }, + rollupOptions: { + output: { + banner: 'import "./style.css"' + }, + external: ['vue'] + } + } +}) diff --git a/packages/canvas/package.json b/packages/canvas/package.json index f2081572d..50205d607 100644 --- a/packages/canvas/package.json +++ b/packages/canvas/package.json @@ -14,6 +14,17 @@ "files": [ "dist" ], + "repository": { + "type": "git", + "url": "https://github.com/opentiny/tiny-engine", + "directory": "packages/canvas" + }, + "bugs": { + "url": "https://github.com/opentiny/tiny-engine/issues" + }, + "author": "OpenTiny Team", + "license": "MIT", + "homepage": "https://opentiny.design/tiny-engine", "dependencies": { "@babel/core": "7.18.13", "@opentiny/tiny-engine-common": "workspace:^1.0.0", @@ -21,6 +32,7 @@ "@opentiny/tiny-engine-i18n-host": "workspace:^1.0.0", "@opentiny/tiny-engine-utils": "workspace:^1.0.0", "@opentiny/tiny-engine-webcomponent-core": "workspace:^1.0.0", + "@opentiny/tiny-engine-builtin-component": "workspace:*", "@opentiny/vue": "~3.10.0", "@opentiny/vue-icon": "~3.10.0", "@opentiny/vue-renderless": "~3.10.0", diff --git a/packages/canvas/src/components/builtin/builtin.json b/packages/canvas/src/components/builtin/builtin.json index 44aaa49f3..9673698c8 100644 --- a/packages/canvas/src/components/builtin/builtin.json +++ b/packages/canvas/src/components/builtin/builtin.json @@ -432,399 +432,6 @@ "configure": { "loop": true } - }, - { - "icon": "Box", - "name": { - "zh_CN": "CanvasRow" - }, - "component": "CanvasRow", - "schema": { - "slots": {}, - "properties": [ - { - "label": { - "zh_CN": "基础信息" - }, - "description": { - "zh_CN": "基础信息" - }, - "collapse": { - "number": 6, - "text": { - "zh_CN": "显示更多" - } - }, - "content": [ - { - "property": "minHeight", - "type": "String", - "defaultValue": "", - "label": { - "text": { - "zh_CN": "最小高度" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaInput", - "props": {} - } - }, - { - "property": "rowGap", - "type": "String", - "defaultValue": "", - "label": { - "text": { - "zh_CN": "行间距" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaInput", - "props": {} - } - }, - { - "property": "colGap", - "type": "String", - "defaultValue": "", - "label": { - "text": { - "zh_CN": "列间距" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaInput", - "props": {} - } - }, - { - "property": "align", - "type": "String", - "defaultValue": "", - "label": { - "text": { - "zh_CN": "副轴对齐" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaSelect", - "props": { - "options": [ - { "value": "flex-start", "label": "头部对齐" }, - { "value": "center", "label": "中间对齐" }, - { "value": "flex-end", "label": "尾端对齐" }, - { "value": "stretch", "label": "拉伸对齐" } - ], - "type": "button" - } - } - }, - { - "property": "justAlign", - "type": "String", - "defaultValue": "", - "label": { - "text": { - "zh_CN": "主轴对齐" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaSelect", - "props": { - "options": [ - { "value": "flex-start", "label": "头部对齐" }, - { "value": "center", "label": "中间对齐" }, - { "value": "flex-end", "label": "尾端对齐" }, - { "value": "space-between", "label": "两端对齐" }, - { "value": "space-evenly", "label": "均分对齐" } - ], - "type": "button" - } - } - } - ] - } - ], - "events": {}, - "shortcuts": { - "properties": [] - }, - "contentMenu": { - "actions": [] - } - }, - "configure": { - "loop": true, - "isContainer": true, - "nestingRule": { - "childWhitelist": [], - "descendantBlacklist": [] - } - } - }, - { - "icon": "Box", - "name": { - "zh_CN": "CanvasCol" - }, - "component": "CanvasCol", - "schema": { - "slots": {}, - "properties": [ - { - "label": { - "zh_CN": "基础信息" - }, - "description": { - "zh_CN": "基础信息" - }, - "collapse": { - "number": 6, - "text": { - "zh_CN": "显示更多" - } - }, - "content": [ - { - "property": "widthType", - "type": "String", - "defaultValue": "auto", - "label": { - "text": { - "zh_CN": "宽度类型" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaRadioGroup", - "props": { - "options": [ - { "label": "auto", "text": "自适应" }, - { "label": "fixed", "text": "固定" } - ], - "type": "button" - } - } - }, - { - "property": "flexBasis", - "type": "String", - "defaultValue": "", - "label": { - "text": { - "zh_CN": "固定宽度" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaInput", - "props": {} - } - }, - { - "property": "rowGap", - "type": "String", - "defaultValue": "", - "label": { - "text": { - "zh_CN": "行间距" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaInput", - "props": {} - } - }, - { - "property": "colGap", - "type": "String", - "defaultValue": "", - "label": { - "text": { - "zh_CN": "列间距" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaInput", - "props": {} - } - }, - { - "property": "align", - "type": "String", - "defaultValue": "", - "label": { - "text": { - "zh_CN": "副轴对齐" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaSelect", - "props": { - "options": [ - { "value": "flex-start", "label": "头部对齐" }, - { "value": "center", "label": "中间对齐" }, - { "value": "flex-end", "label": "尾端对齐" }, - { "value": "stretch", "label": "拉伸对齐" } - ], - "type": "button" - } - } - }, - { - "property": "justAlign", - "type": "String", - "defaultValue": "", - "label": { - "text": { - "zh_CN": "主轴对齐" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaSelect", - "props": { - "options": [ - { "value": "flex-start", "label": "头部对齐" }, - { "value": "center", "label": "中间对齐" }, - { "value": "flex-end", "label": "尾端对齐" }, - { "value": "space-between", "label": "两端对齐" }, - { "value": "space-evenly", "label": "均分对齐" } - ], - "type": "button" - } - } - }, - { - "property": "grow", - "type": "String", - "defaultValue": "", - "label": { - "text": { - "zh_CN": "增长" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaSwitch", - "props": {} - } - }, - { - "property": "shrink", - "type": "String", - "defaultValue": "", - "label": { - "text": { - "zh_CN": "收缩" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaSwitch", - "props": {} - } - } - ] - } - ], - "events": {}, - "shortcuts": { - "properties": [] - }, - "contentMenu": { - "actions": [] - } - }, - "configure": { - "loop": true, - "isContainer": true, - "nestingRule": { - "childWhitelist": [], - "descendantBlacklist": [] - } - } - }, - { - "icon": "Box", - "name": { - "zh_CN": "行列容器" - }, - "component": "CanvasRowColContainer", - "schema": { - "slots": {}, - "properties": [ - { - "label": { - "zh_CN": "基础信息" - }, - "description": { - "zh_CN": "基础信息" - }, - "collapse": { - "number": 6, - "text": { - "zh_CN": "显示更多" - } - }, - "content": [ - { - "property": "rowGap", - "type": "String", - "defaultValue": "", - "label": { - "text": { - "zh_CN": "行间距" - } - }, - "cols": 12, - "rules": [], - "widget": { - "component": "MetaInput", - "props": {} - } - } - ] - } - ], - "events": {}, - "shortcuts": { - "properties": [] - }, - "contentMenu": { - "actions": [] - } - }, - "configure": { - "loop": true, - "isContainer": true, - "nestingRule": { - "childWhitelist": [], - "descendantBlacklist": [] - } - } } ] } @@ -911,41 +518,6 @@ "style": "width: 200px; height: 200px" } } - }, - { - "name": { - "zh_CN": "行列容器" - }, - "screenshot": "", - "snippetName": "CanvasRowColContainer", - "icon": "Box", - "schema": { - "componentName": "CanvasRowColContainer", - "props": { - "rowGap": "20px" - }, - "children": [ - { - "componentName": "CanvasRow", - "props": { - "rowGap": "20px", - "colGap": "20px" - }, - "children": [ - { - "componentName": "CanvasCol", - "props": { - "rowGap": "20px", - "colGap": "20px", - "grow": true, - "shrink": true, - "widthType": "auto" - } - } - ] - } - ] - } } ] } diff --git a/packages/canvas/src/components/builtin/index.js b/packages/canvas/src/components/builtin/index.js index 42be89f5c..f857ff1a1 100644 --- a/packages/canvas/src/components/builtin/index.js +++ b/packages/canvas/src/components/builtin/index.js @@ -1,14 +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. -* -*/ + * 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 CanvasText from './CanvasText.vue' import CanvasBox from './CanvasBox.vue' @@ -16,18 +16,6 @@ import CanvasCollection from './CanvasCollection.vue' import CanvasIcon from './CanvasIcon.vue' import CanvasSlot from './CanvasSlot.vue' import CanvasImg from './CanvasImg.vue' -import CanvasRow from './CanvasRow.vue' -import CanvasCol from './CanvasCol.vue' -import CanvasRowColContainer from './CanvasRowColContainer.vue' +import CanvasPlaceholder from './CanvasPlaceholder.vue' -export { - CanvasText, - CanvasBox, - CanvasCollection, - CanvasIcon, - CanvasSlot, - CanvasImg, - CanvasRow, - CanvasCol, - CanvasRowColContainer -} +export { CanvasText, CanvasBox, CanvasCollection, CanvasIcon, CanvasSlot, CanvasImg, CanvasPlaceholder } diff --git a/packages/canvas/src/components/container/CanvasContainer.vue b/packages/canvas/src/components/container/CanvasContainer.vue index 6d0ecc673..626887f4f 100644 --- a/packages/canvas/src/components/container/CanvasContainer.vue +++ b/packages/canvas/src/components/container/CanvasContainer.vue @@ -223,16 +223,19 @@ export default { diff --git a/packages/plugins/materials/src/block/BlockGroup.vue b/packages/plugins/materials/src/block/BlockGroup.vue index 9567fbd88..2e93fa7ef 100644 --- a/packages/plugins/materials/src/block/BlockGroup.vue +++ b/packages/plugins/materials/src/block/BlockGroup.vue @@ -85,7 +85,7 @@ class="confirm-btn" size="small" type="primary" - @click="handleConfirmDeleteGroup(item.value.groupId)" + @click="handleConfirmDeleteGroup(item.value)" > 确定 @@ -145,6 +145,7 @@ import { DialogBox, Button, Tooltip, + Notify, Popover } from '@opentiny/vue' import { iconYes, iconClose, iconError } from '@opentiny/vue-icon' @@ -319,7 +320,9 @@ export default { }) } - const handleConfirmDeleteGroup = (groupId) => { + const handleConfirmDeleteGroup = (group) => { + const { groupId, groupName } = group + const messageSuccess = `${groupName}分组删除成功!` requestDeleteGroup(groupId) .then(() => { state.currentDeleteGroupId = null @@ -330,6 +333,11 @@ export default { setBlockPanelVisible(false) } }) + Notify({ + type: 'success', + message: messageSuccess, + position: 'top-right' + }) }) .catch((error) => { message({ message: `删除区块分组失败: ${error.message || error}`, status: 'error' }) diff --git a/packages/plugins/materials/src/block/BlockGroupTransfer.vue b/packages/plugins/materials/src/block/BlockGroupTransfer.vue index 5f27d8f35..b3292f9c5 100644 --- a/packages/plugins/materials/src/block/BlockGroupTransfer.vue +++ b/packages/plugins/materials/src/block/BlockGroupTransfer.vue @@ -73,7 +73,7 @@ export default { }, { id: 'mini', - name: '小列表', + name: '列表', svgName: 'small-list' } ] diff --git a/packages/plugins/materials/src/block/BlockGroupTransferPanel.vue b/packages/plugins/materials/src/block/BlockGroupTransferPanel.vue index 75e0e4886..cf9ff7868 100644 --- a/packages/plugins/materials/src/block/BlockGroupTransferPanel.vue +++ b/packages/plugins/materials/src/block/BlockGroupTransferPanel.vue @@ -65,7 +65,6 @@ export default { :deep(.block-list) { border: none; max-height: none; - &.is-list, &.is-small-list { .block-detail { top: 50%; diff --git a/packages/plugins/materials/src/component/Main.vue b/packages/plugins/materials/src/component/Main.vue index 5a53125ac..fc8f6f670 100644 --- a/packages/plugins/materials/src/component/Main.vue +++ b/packages/plugins/materials/src/component/Main.vue @@ -117,6 +117,8 @@ export default { diff --git a/packages/vue-generator/test/testcases/full/index.config.js b/packages/vue-generator/test/testcases/full/index.config.js index 2a6ccea62..6d6c8a064 100644 --- a/packages/vue-generator/test/testcases/full/index.config.js +++ b/packages/vue-generator/test/testcases/full/index.config.js @@ -1,14 +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. -* -*/ + * 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. + * + */ module.exports = { description: @@ -28,6 +28,11 @@ module.exports = { name: 'case3_state-accessor', pageName: 'UseStateAccessor', description: '测试区块的 state 支持 accessor 协议' + }, + { + name: 'case4_canvasrow-component', + pageName: 'BuiltInComponent', + description: '测试内置组件 CanvasRow、CanvasCol、CanvasRowColContainer' } ], input: { diff --git a/packages/vue-generator/test/testcases/full/index.js b/packages/vue-generator/test/testcases/full/index.js index bddead547..7f9d2b8ea 100644 --- a/packages/vue-generator/test/testcases/full/index.js +++ b/packages/vue-generator/test/testcases/full/index.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. + * + */ const path = require('path') const fs = require('fs-extra') const prettier = require('prettier') const { execSync } = require('child_process') -const { generateCode } = require('../../../dist/lowcode-dsl-vue.cjs.js') +const { generateCode } = require('../../../dist/tiny-engine-dsl-vue.cjs') const { logger } = require('../../utils/logger') const getPageData = (testCaseFile) => { diff --git a/packages/webcomponent/package.json b/packages/webcomponent/package.json index 4905f7094..c94d87975 100644 --- a/packages/webcomponent/package.json +++ b/packages/webcomponent/package.json @@ -5,7 +5,6 @@ "access": "public" }, "description": "webcomponent vue core", - "author": "tinybuilder", "scripts": { "dev": "vite", "build": "vite build", @@ -18,6 +17,17 @@ ], "main": "dist/tiny-engine-webcomponent-core.umd.js", "module": "dist/tiny-engine-webcomponent-core.es.js", + "repository": { + "type": "git", + "url": "https://github.com/opentiny/tiny-engine", + "directory": "packages/webcomponent" + }, + "bugs": { + "url": "https://github.com/opentiny/tiny-engine/issues" + }, + "author": "OpenTiny Team", + "license": "MIT", + "homepage": "https://opentiny.design/tiny-engine", "dependencies": { "@vue/shared": "^3.3.4", "vue": "^3.2.1" diff --git a/scripts/setup.js b/scripts/setup.js new file mode 100644 index 000000000..64a7d1f23 --- /dev/null +++ b/scripts/setup.js @@ -0,0 +1,9 @@ +const { exec } = require('child_process') +const fs = require('fs') +const path = require('path') + +fs.access(path.resolve(__dirname, 'packages/vue-generator/dist'), (err) => { + if (err) { + exec('pnpm -F @opentiny/tiny-engine-dsl-vue build') + } +})