init project

Match-id-61778b743a9dc8d8df471dcb285fb229931648a6
This commit is contained in:
OpenTiny 2023-09-25 18:11:29 +08:00
parent 3f9aaa17e1
commit 0854e5190e
1387 changed files with 191088 additions and 1 deletions

14
.build_config/build.sh Normal file
View File

@ -0,0 +1,14 @@
if [ ! $version ];
then npm version 0.1.0-`date "+%Y%m%d%H%M%S"`;
else npm version $version;
fi
npm install
if [ $? -ne 0 ]
then
echo "[ERROR] build falid!"
exit 1
fi
echo '[INFO] build completed'

View File

@ -0,0 +1,23 @@
version: 1.0
name: tiny-engine
language: nodejs
# 构建工具
dependencies:
base:
nodejs: best
# 构建机器
machine:
standard:
euler:
- default
# 构建脚本
scripts:
- sh ./.build_config/build.sh
# 构建产物
artifacts:
npm_deploy:
- config_path: ./package.json

11
.codecheck/check.yml Normal file
View File

@ -0,0 +1,11 @@
version: 2.0
steps:
pre_codecheck:
- checkout
tool_params:
secsolar:
source_dir: ./
cmetrics:
exclude: vite.config.js|package.json|index.js|mockServer/assets

4
.env.alpha Normal file
View File

@ -0,0 +1,4 @@
# alpha mode, used by the "build:alpha" script
NODE_ENV=production
#VITE_ORIGIN=

5
.env.development Normal file
View File

@ -0,0 +1,5 @@
# development mode, used by the "vite" command
NODE_ENV=development
# request data via alpha service
#VITE_ORIGIN=

4
.env.prod Normal file
View File

@ -0,0 +1,4 @@
# prod mode, used by the "build:prod" script
NODE_ENV=production
#VITE_ORIGIN=

7
.eslintignore Normal file
View File

@ -0,0 +1,7 @@
.vscode
dist
public
package-lock.json
**/node_modules/**
tmp
temp

31
.eslintrc.js Normal file
View File

@ -0,0 +1,31 @@
module.exports = {
env: {
browser: true,
es2015: true,
worker: true,
node: true,
jest: true
},
extends: ['eslint:recommended', 'plugin:vue/vue3-essential'],
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@babel/eslint-parser',
ecmaVersion: 'latest',
sourceType: 'module',
requireConfigFile: false,
babelOptions: {
parserOpts: {
plugins: ['jsx']
}
}
},
plugins: ['vue'],
rules: {
'no-console': 'error',
'no-debugger': 'error',
'space-before-function-paren': 'off',
'vue/multi-word-component-names': 'off',
'no-use-before-define': 'error',
'no-unused-vars': ['error', { ignoreRestSiblings: true, varsIgnorePattern: '^_', argsIgnorePattern: '^_' }]
}
}

26
.gitignore vendored Normal file
View File

@ -0,0 +1,26 @@
.DS_Store
node_modules
dist/
package-lock.json
yarn.lock
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
tmp
temp

6
.husky/pre-commit Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
# npm run lint
npx lint-staged

24
.npmignore Normal file
View File

@ -0,0 +1,24 @@
.build_config
.cid
.codecheck
.husky
.vscode
# 只忽略根目录的 dist 文件夹
/dist
test
node_modules
.editorconfig
.eslintignore
.eslintrc.js
.prettierignore
.prettierrc
jsconfig.json
package-lock.json
# 忽略可能存在的其它编辑器文件夹
.idea
/src/app/public/mock/*
!/src/app/public/mock/graph-bundle.json
tmp
temp

3
.prettierignore Normal file
View File

@ -0,0 +1,3 @@
dist
package-lock.json
**/node_modules/**

5
.prettierrc Normal file
View File

@ -0,0 +1,5 @@
semi: false
singleQuote: true
printWidth: 120
trailingComma: 'none'
endOfLine: 'auto'

17
CHNAGELOG.md Normal file
View File

@ -0,0 +1,17 @@
# 更新日志
## v1.0.0-alpha.0
`2023/09/25`
### 📢 破坏性变更
### ✨ 新特性
- 首个版本提交
### 🐞 缺陷修复

83
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,83 @@
# Contributing
We are glad that you are willing to contribute to the TinyEngine open source project. There are many forms of contribution. You can choose one or more of them based on your strengths and interests:
- Report [new defect](https://github.com/opentiny/tiny-engine/issues/new?template=bug-report.yml).
- Provide more detailed information for the [existing defects](https://github.com/opentiny/tiny-engine/labels/bug), such as supplementary screenshots, more detailed reproduction steps, minimum reproducible demo links, etc.
- Submit Pull requests to fix typos in the document or make the document clearer and better.
- Add the official assistant WeChat `opentiny-official` and join the technical exchange group to participate in the discussion.
When you personally use the TinyEngine component library and participate in many of the above contributions, as you become familiar with TinyEngine , you can try to do something more challenging, such as:
- Fix the defect. You can start with [Good-first issue](https://github.com/opentiny/tiny-engine/labels/good%20first%20issue).
- Implementation of new features
- Complete unit tests.
- Translate documents
- Participate in code review.
## Bug Reports
If you encounter problems in the process of using TinyEngine components, you are welcome to submit Issue to us. Before submitting Issue, please read the relevant [official documentation](https://opentiny.design/tiny-engine) carefully to confirm whether this is a defect or an unimplemented function.
If it is a defect, select [Bug report](https://github.com/opentiny/tiny-engine/issues/new?template=bug-report.yml) template when creating a new Issue. The title follows the format of `[toolkitName/pluginName/EngineCore] defect description`. For example: `[tiny-engine-toolbar-refresh] The refresh function cannot be used`.
Issue that reports defects mainly needs to fill in the following information:
- Version numbers of `tiny-engine` and `node`.
- The performance of the defect can be illustrated by screenshot, and if there is an error, the error message can be posted.
- Defect reproduction step, preferably with a minimum reproducible demo link.
If it is a new feature, select [Feature request](https://github.com/opentiny/tiny-engine/issues/new?template=feature-request.yml) template. The title follows the format of `[toolkitName/pluginName/EngineCore] new feature description`. For example: `[tiny-engine-theme] New Blue Theme`.
The following information is required for the Issue of the new feature:
- What problems does this feature mainly solve for users?
- What is the api of this feature?
## Pull Requests
Before submitting pull request, please make sure that your submission is in line with the overall plan of TinyEngine. Generally, issues that marked as [bug](https://github.com/opentiny/tiny-engine/labels/bug) are encouraged to submit pull requests. If you are not sure, you can create a [Discussion](https://github.com/opentiny/tiny-engine/discussions) for discussion.
Local startup steps:
- Click the Fork button in the upper right corner of the [TinyEngine](https://github.com/opentiny/tiny-engine) code repository to fork the upstream warehouse to the personal warehouse.
- Clone personal warehouse to local
- Run `npm install` under the TinyEngine root directory to install node dependencies.
- Run `npm install` under the TinyEngine mockServer to install node dependencies
- Run `npm run serve` under the TinyEngine root directory, and then `run npm run dev` in the mockServer directory to start local development.
```shell
# username indicates the user name. Replace it before running the command.
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
# Start the project.
$ npm run serve
# start another terminal
$ cd mockServer
$ npm run dev
```
To submit a PR:
- Create a new branch `git checkout -b username/feature1`. The name of the branch should be `username/feat-xxx` / `username/fix-xxx`.
- 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`.
- 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.
- Project administrator merges PR.
The contribution process is over, thank you for your contribution!
## Join the open source community
If you are interested in our open source projects, please join our open source community in the following ways.
- Add the official assistant WeChat: opentiny-official, join our technical exchange group
- Join the mailing list: opentiny@googlegroups.com

84
CONTRIBUTING.zh-CN.md Normal file
View File

@ -0,0 +1,84 @@
# 贡献指南
很高兴你有意愿参与 TinyEngine 开源项目的贡献,参与贡献的形式有很多种,你可以根据自己的特长和兴趣选择其中的一个或多个:
- 报告[新缺陷](https://github.com/opentiny/tiny-engine/issues/new?template=bug-report.yml)
- 为[已有缺陷](https://github.com/opentiny/tiny-engine/labels/bug)提供更详细的信息,比如补充截图、提供更详细的复现步骤、提供最小可复现 demo 链接等
- 提交 Pull requests 修复文档中的错别字或让文档更清晰和完善
- 添加官方小助手微信 opentiny-official加入技术交流群参与讨论
当你亲自使用 TinyEngine 组件库,并参与多次以上形式的贡献,对 TinyEngine 逐渐熟悉之后,可以尝试做一些更有挑战的事情,比如:
- 修复缺陷,可以先从 [Good-first issue](https://github.com/opentiny/tiny-engine/labels/good%20first%20issue) 开始
- 实现新特性
- 完善单元测试
- 翻译文档
- 参与代码检视
## 提交 Issue
如果你在使用 TinyEngine 组件过程中遇到问题,欢迎给我们提交 Issue提交 Issue 之前,请先仔细阅读相关的[官方文档](https://opentiny.design/tiny-engine),确认这是一个缺陷还是尚未实现的功能。
如果是一个缺陷,创建新 Issue 时选择 [Bug report](https://github.com/opentiny/tiny-engine/issues/new?template=bug-report.yml) 模板,标题遵循 `[toolkitName/pluginName/EngineCore]缺陷简述` 的格式,比如:`[tiny-engine-toolbar-refresh] 刷新功能无法使用`。
报告缺陷的 Issue 主要需要填写以下信息:
- tiny-engine 和 node 的版本号
- 缺陷的表现,可截图辅助说明,如果有报错可贴上报错信息
- 缺陷的复现步骤,最好能提供一个最小可复现 demo 链接
如果是一个新特性,则选择 [Feature request](https://github.com/opentiny/tiny-engine/issues/new?template=feature-request.yml) 模板,标题遵循 `[toolkitName/pluginName/EngineCore]新特性简述` 的格式,比如:`[tiny-engine-theme] 新增蓝色主题`。
新特性的 Issue 主要需要填写以下信息:
- 该特性主要解决用户的什么问题
- 该特性的 api 是什么样的
## 提交 PR
提交 PR 之前,请先确保你提交的内容是符合 TinyEngine 整体规划的,一般已经标记为 [bug](https://github.com/opentiny/tiny-engine/labels/bug) 的 Issue 是鼓励提交 PR 的,如果你不是很确定,可以创建一个 [Discussion](https://github.com/opentiny/tiny-engine/discussions) 进行讨论。
本地启动步骤:
- 点击 [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`,启动本地开发
```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
# 启动项目
$ npm run serve
# start another terminal
$ cd mockServer
$ npm run dev
```
提交 PR 的步骤:
- 创建新分支 `git checkout -b username/feature1`,分支名字建议为 `username/feat-xxx` / `username/fix-xxx`
- 本地编码
- 遵循 Commit Message Format 规范进行提交,不符合提交规范的 PR 将不会被合并
- 提交到远程仓库git push origin branchName
- (可选)同步上游仓库 dev 分支最新代码git pull upstream dev
- 打开 TinyEngine 代码仓库的 [Pull requests](https://github.com/opentiny/tiny-engine/pulls) 链接,点击 New pull request 按钮提交 PR
- 项目 Committer 进行 Code Review并提出意见
- PR 作者根据意见调整代码,请注意一个分支发起了 PR 后,后续的 commit 会自动同步,无需重新提交 PR
- 项目管理员合并 PR
贡献流程结束,感谢你的贡献!
## 加入开源社区
如果你对我们的开源项目感兴趣,欢迎通过以下方式加入我们的开源社区。
- 添加官方小助手微信opentiny-official加入我们的技术交流群
- 加入邮件列表opentiny@googlegroups.com

22
LICENSE Normal file
View File

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2023 - present TinyEngine Authors.
Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

102
README.en-US.md Normal file
View File

@ -0,0 +1,102 @@
<p align="center">
<a href="https://opentiny.design/tiny-engine" target="_blank" rel="noopener noreferrer">
<img alt="OpenTiny Logo" src="logo.svg" height="100" style="max-width:100%;">
</a>
</p>
<p align="center">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.</p>
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
$ npm install
$ pushd mockServer
$ npm install
$ popd
```
### Local development: Start the local mock server and use the mock data of the local mock server.
```sh
$ npm run serve
# start another terminal
$ cd mockServer
$ npm run 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
- `pagdId=xxx` Page ID
## Build
```sh
# Build all plug-ins first
npm run build:plugin
# Build Designer
npm run build:alpha or build:prod
# Release all plug-ins.
npm run publish:plugin
# Publish the designer.
npm run publish:core
```
## Common Packet Sending Process
1. Release the plug-in.
```sh
npm run build:plugin && npm run publish:plugin
```
2. Publish Designer
a) Change the package name and version number.
Package name: @opentiny/tinybuilder-design-core-test
Version number: The last digit plus 1 each time. For example:
```
"name": "@opentiny/tinybuilder-design-core-test",
"version": "1.0.87",
```
b) npm publish
## 🤝 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
## Open source protocol
[MIT](LICENSE)
```
```

View File

@ -1,2 +1,98 @@
# lowcode-design-core
<p align="center">
<a href="https://opentiny.design/tiny-engine" target="_blank" rel="noopener noreferrer">
<img alt="OpenTiny Logo" src="logo.svg" height="100" style="max-width:100%;">
</a>
</p>
<p align="center">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.</p>
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
$ npm install
$ pushd mockServer
$ npm install
$ popd
```
### Local development: Start the local mock server and use the mock data of the local mock server.
```sh
$ npm run serve
# start another terminal
$ cd mockServer
$ npm run 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
- `pagdId=xxx` Page ID
## Build
```sh
# Build all plug-ins first
npm run build:plugin
# Build Designer
npm run build:alpha or build:prod
# Release all plug-ins.
npm run publish:plugin
# Publish the designer.
npm run publish:core
```
## Common Packet Sending Process
1. Release the plug-in.
```sh
npm run build:plugin && npm run publish:plugin
```
2. Publish Designer
a) Change the package name and version number.
Package name: @opentiny/tinybuilder-design-core-test
Version number: The last digit plus 1 each time. For example:
```
"name": "@opentiny/tinybuilder-design-core-test",
"version": "1.0.87",
```
b) npm publish
## 🤝 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
## Open source protocol
[MIT](LICENSE)

96
README.zh-CN.md Normal file
View File

@ -0,0 +1,96 @@
<p align="center">
<a href="https://opentiny.design/tiny-engine" target="_blank" rel="noopener noreferrer">
<img alt="OpenTiny Logo" src="logo.svg" height="100" style="max-width:100%;">
</a>
</p>
<p align="center">TinyEngine低代码引擎使能开发者定制低代码平台支持在线实时构建低码平台支持二次开发或集成低码平台能力</p>
[English](README.md) | 简体中文
🌈 特性:
- 跨端跨框架前端组件
- 支持在线实时构建、支持二次开发或被集成
- 直接生成可部署的源码,运行时无需引擎支撑
- 允许接入第三方组件、允许定制扩展插件
- 支持高代码与低代码,混合开发部署应用
- 平台接入 AI 大模型能力,辅助开发者构建应用
## 开发
### 安装所需的依赖
```sh
$ npm install
$ pushd mockServer
$ npm install
$ popd
```
### 本地开发,启动本地 mock 服务器,使用本地 mock 服务器的 mock 数据
```sh
$ npm run serve
# 另起一个终端
$ cd mockServer
$ npm run dev
```
浏览器打开:`http://localhost:8080/?type=app&id=918&tenant=1&pageid=NTJ4MjvqoVj8OVsc`
`url search`参数:
- `type=app` 应用类型
- `id=xxx` 应用 ID
- `tenant=xxx` 组织 ID
- `pagdId=xxx` 页面 ID
## 构建
```sh
# 先构建所有插件
npm run build:plugin
# 构建设计器
npm run build:alpha 或 build:prod
# 发布所有插件
npm run publish:plugin
# 发布设计器
npm run publish:core
```
## 常规发包流程
1. 发布插件
npm run build:plugin && npm run publish:plugin
2. 发布设计器
a) 修改包名和版本号:
包名:@opentiny/tinybuilder-design-core-test
版本号:末位每次+1, 例如:
```
"name": "@opentiny/tinybuilder-design-core-test",
"version": "1.0.87",
```
b) npm publish
## 🤝 参与贡献
如果你对我们的开源项目感兴趣,欢迎加入我们!🎉
参与贡献之前请先阅读[贡献指南](CONTRIBUTING.zh-CN.md)。
- 添加官方小助手微信 opentiny-official加入技术交流群
- 加入邮件列表 opentiny@googlegroups.com
## 开源协议
[MIT](LICENSE)

266
canvas.html Normal file
View File

@ -0,0 +1,266 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://unpkg.com/@opentiny/vue-theme@3/index.css" rel="stylesheet" />
<style type="text/css">
.loading-warp {
display: flex;
flex-direction: column;
justify-content: center;
position: fixed;
top: -75px;
bottom: 0;
left: 0;
right: 0;
}
.loading {
width: 60px;
height: 60px;
margin: 0 auto;
position: relative;
animation: load 3s linear infinite;
}
.loading div {
width: 100%;
height: 100%;
position: absolute;
}
.loading span {
display: inline-block;
width: 20px;
height: 20px;
border-radius: 50%;
background: #99cc66;
position: absolute;
left: 50%;
margin-top: -10px;
margin-left: -10px;
animation: changeBgColor 3s ease infinite;
}
@keyframes load {
0% {
transform: rotate(0deg);
}
33.3% {
transform: rotate(120deg);
}
66.6% {
transform: rotate(240deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes changeBgColor {
0%,
100% {
background: #99cc66;
}
33.3% {
background: #ffff66;
}
66.6% {
background: #ff6666;
}
}
.loading div:nth-child(2) {
transform: rotate(120deg);
}
.loading div:nth-child(3) {
transform: rotate(240deg);
}
.loading div:nth-child(2) span {
animation-delay: 1s;
}
.loading div:nth-child(3) span {
animation-delay: 2s;
}
html,
body,
div,
span,
object,
iframe,
p,
blockquote,
pre,
abbr,
address,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
samp,
small,
strong,
sub,
sup,
var,
b,
i,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
background: transparent;
user-select: none;
}
html,
body {
width: 100%;
height: 100%;
min-height: 100vh;
}
.design-canvas {
margin: 0;
padding: 0;
}
body::-webkit-scrollbar {
width: 8px;
height: 8px;
}
body::-webkit-scrollbar-track,
body::-webkit-scrollbar-track-piece,
body::-webkit-scrollbar-corner {
background-color: transparent;
}
body::-webkit-scrollbar-thumb {
background-color: #dbdbdb;
border-radius: 4px;
}
body::-webkit-scrollbar-thumb:hover {
background-color: #c2c2c2;
}
.design-page {
display: block;
height: 100%;
}
.design-page > :not(:defined):empty {
display: flex;
margin: 10px;
align-items: center;
}
/* 此选择器表示所有未被定义的自定义元素,用来表示区块还没加载完成,并添加加载中动画 */
.design-page > :not(:defined):empty::before {
content: '';
display: block;
width: 20px;
height: 20px;
border: 3px solid #4f77ff;
border-top-color: transparent;
border-radius: 100%;
animation: circle infinite 0.75s linear;
}
/* 以下代码是为了保证区块还没加载完成之前不显示内部插槽内容 */
.design-page > :not(:defined):empty > * {
display: none;
}
.design-page > :not(:defined):empty::after {
margin-left: 10px;
content: '区块加载中...';
font-size: 16px;
}
.canvas-container {
background: #f1f1f1;
height: 100%;
}
.canvas-container .container-box {
background-repeat: no-repeat;
background-size: 1px 100%, 100% 1px;
background-position: 100% 0, 100% 100%;
position: relative;
height: 100%;
background-image: linear-gradient(-90deg, #e0e0e0, #e0e0e0), linear-gradient(-180deg, #e0e0e0, #e0e0e0);
}
.design-page .tiny-row .tiny-col:empty {
min-height: 30px;
border: 1px solid #ccc;
}
.canvas-container .container-box .container-tip {
background-repeat: no-repeat;
background-size: 1px 100%, 100% 1px;
background-position: initial;
font-size: 14px;
font-weight: 400;
height: 100%;
min-height: 48px;
display: flex;
align-items: center;
justify-content: center;
color: #a7b1bd;
background-image: linear-gradient(-90deg, #e0e0e0, #e0e0e0), linear-gradient(-180deg, #e0e0e0, #e0e0e0);
}
.canvas-grid-bg {
background-image: linear-gradient(#dadada7d 1px, transparent 0),
linear-gradient(90deg, #dadada7d 1px, transparent 0), linear-gradient(#dadada 1px, transparent 0),
linear-gradient(90deg, #dadada 1px, transparent 0);
background-size: 11px 11px, 11px 11px, 55px 55px, 55px 55px;
background-color: rgb(255, 255, 255);
}
@keyframes circle {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body class="design-canvas" id="app">
<div class="loading-warp">
<div class="loading">
<div><span></span></div>
<div><span></span></div>
<div><span></span></div>
</div>
</div>
<script type="module" src="/src/canvas/src/components/render/runner.js"></script>
</body>
</html>

131
index.html Normal file
View File

@ -0,0 +1,131 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="/favicon.ico" />
<title>TinyEditor 前端可视化设计器</title>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
.loading {
width: 100%;
height: 100%;
background: #fff;
position: absolute;
}
.loading .loadingco {
width: 200px;
height: 80px;
text-align: center;
z-index: 1;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
.loading h2 {
color: #666;
margin: 0;
text-transform: uppercase;
letter-spacing: 0.1em;
font-size: 20px;
font-weight: 400;
font-family: Arial, Helvetica, sans-serif;
}
.loading span {
display: inline-block;
vertical-align: middle;
width: 0.6em;
height: 0.6em;
margin: 0.19em;
background: #007db6;
border-radius: 0.6em;
-webkit-animation: loading 1s infinite alternate;
animation: loading 1s infinite alternate;
}
.loading span:nth-of-type(2) {
background: #008fb2;
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}
.loading span:nth-of-type(3) {
background: #009b9e;
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s;
}
.loading span:nth-of-type(4) {
background: #00a77d;
-webkit-animation-delay: 0.6s;
animation-delay: 0.6s;
}
.loading span:nth-of-type(5) {
background: #00b247;
-webkit-animation-delay: 0.8s;
animation-delay: 0.8s;
}
.loading span:nth-of-type(6) {
background: #5ab027;
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
.loading span:nth-of-type(7) {
background: #a0b61e;
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s;
}
@-webkit-keyframes loading {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes loading {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
</style>
</head>
<body>
<div id="app">
<div class="loading">
<div class="loadingco">
<h2>Loading</h2>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
<script type="module" src="/src/app/src/main.js"></script>
</body>
</html>

73
jsconfig.json Normal file
View File

@ -0,0 +1,73 @@
{
"compilerOptions": {
"baseUrl": "./",
"jsx": "react",
"paths": {
"@/*": ["src/*"],
"@opentiny/tiny-engine-canvas": ["src/canvas/src/index.js"],
"@opentiny/tiny-engine-controller": ["src/controller/src/index"],
"@opentiny/tiny-engine-plugin-materials": ["src/plugins/packages/materials/index"],
"@opentiny/tiny-engine-plugin-data": ["src/plugins/packages/data/index"],
"@opentiny/tiny-engine-plugin-script": ["src/plugins/packages/script/index"],
"@opentiny/tiny-engine-plugin-tree": ["src/plugins/packages/tree/index"],
"@opentiny/tiny-engine-plugin-help": ["src/plugins/packages/help/index"],
"@opentiny/tiny-engine-plugin-schema": ["src/plugins/packages/schema/index"],
"@opentiny/tiny-engine-plugin-page": ["src/plugins/packages/page/index"],
"@opentiny/tiny-engine-plugin-i18n": ["src/plugins/packages/i18n/index"],
"@opentiny/tiny-engine-plugin-bridge": ["src/plugins/packages/bridge/index"],
"@opentiny/tiny-engine-setting-events": ["src/settings/packages/events/index"],
"@opentiny/tiny-engine-setting-props": ["src/settings/packages/props/index"],
"@opentiny/tiny-engine-common": ["src/common/index"],
"@opentiny/tiny-engine-setting-styles": ["src/settings/packages/styles/index"],
"@opentiny/tiny-engine-toolbar-breadcrumb": ["src/toolbars/packages/breadcrumb/index"],
"@opentiny/tiny-engine-toolbar-fullscreen": ["src/toolbars/packages/fullscreen/index"],
"@opentiny/tiny-engine-toolbar-lang": ["src/toolbars/packages/lang/index"],
"@opentiny/tiny-engine-toolbar-layout": ["src/toolbars/packages/layout/index"],
"@opentiny/tiny-engine-toolbar-checkinout": ["src/toolbars/packages/lock/index"],
"@opentiny/tiny-engine-toolbar-logo": ["src/toolbars/packages/logo/index"],
"@opentiny/tiny-engine-toolbar-media": ["src/toolbars/packages/media/index"],
"@opentiny/tiny-engine-toolbar-preview": ["src/toolbars/packages/preview/index"],
"@opentiny/tiny-engine-toolbar-generate-vue": ["src/toolbars/packages/generate-vue/index"],
"@opentiny/tiny-engine-toolbar-clean": ["src/toolbars/packages/clean/index"],
"@opentiny/tiny-engine-toolbar-save": ["src/toolbars/packages/save/index"],
"tiny-engine-canvas": ["src/canvas/index"],
"@opentiny/tiny-engine-theme-dark": ["src/theme/packages/dark/index.less"],
"@opentiny/tiny-engine-theme-light": ["src/theme/packages/light/index.less"],
"@opentiny/tiny-engine-svgs": ["src/svgs/index"],
"@opentiny/tiny-engine-http": ["src/http/index"],
"@opentiny/tiny-engine-controller/*": ["src/controller/src/*"],
"@opentiny/tiny-engine-plugin-materials/*": ["src/plugins/packages/materials/*"],
"@opentiny/tiny-engine-plugin-data/*": ["src/plugins/packages/data/*"],
"@opentiny/tiny-engine-plugin-script/*": ["src/plugins/packages/script/*"],
"@opentiny/tiny-engine-plugin-tree/*": ["src/plugins/packages/tree/*"],
"@opentiny/tiny-engine-plugin-help/*": ["src/plugins/packages/help/*"],
"@opentiny/tiny-engine-plugin-schema/*": ["src/plugins/packages/schema/*"],
"@opentiny/tiny-engine-plugin-page/*": ["src/plugins/packages/page/*"],
"@opentiny/tiny-engine-plugin-i18n/*": ["src/plugins/packages/i18n/*"],
"@opentiny/tiny-engine-plugin-bridge/*": ["src/plugins/packages/bridge/*"],
"@opentiny/tiny-engine-setting-events/*": ["src/settings/packages/events/*"],
"@opentiny/tiny-engine-setting-props/*": ["src/settings/packages/props/*"],
"@opentiny/tiny-engine-common/*": ["src/common/*"],
"@opentiny/tiny-engine-setting-styles/*": ["src/settings/packages/styles/*"],
"@opentiny/tiny-engine-toolbar-breadcrumb/*": ["src/toolbars/packages/breadcrumb/*"],
"@opentiny/tiny-engine-toolbar-fullscreen/*": ["src/toolbars/packages/fullscreen/*"],
"@opentiny/tiny-engine-toolbar-lang/*": ["src/toolbars/packages/lang/*"],
"@opentiny/tiny-engine-toolbar-layout/*": ["src/toolbars/packages/layout/*"],
"@opentiny/tiny-engine-toolbar-checkinout/*": ["src/toolbars/packages/lock/*"],
"@opentiny/tiny-engine-toolbar-logo/*": ["src/toolbars/packages/logo/*"],
"@opentiny/tiny-engine-toolbar-media/*": ["src/toolbars/packages/media/*"],
"@opentiny/tiny-engine-toolbar-preview/*": ["src/toolbars/packages/preview/*"],
"@opentiny/tiny-engine-toolbar-clean/*": ["src/toolbars/packages/clean/*"],
"@opentiny/tiny-engine-toolbar-save/*": ["src/toolbars/packages/save/*"],
"@opentiny/tiny-engine-theme-dark/*": ["src/theme/packages/dark/*"],
"@opentiny/tiny-engine-theme-light/*": ["src/theme/packages/light/*"],
"@opentiny/tiny-engine-svgs/*": ["src/svgs/*"],
"@opentiny/tiny-engine-http/*": ["src/http/*"],
"@opentiny/tiny-engine-utils": ["src/utils/src/index.js"],
"@opentiny/tiny-engine-webcomponent-core": ["src/webcomponent/src/lib"],
"@opentiny/tiny-engine-i18n-host": ["src/i18n/src/lib"]
}
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}

11
lerna.json Normal file
View File

@ -0,0 +1,11 @@
{
"packages": [
"src/*",
"src/plugins/packages/*",
"src/settings/packages/*",
"src/theme/packages/*",
"src/toolbars/packages/*"
],
"useNx": false,
"version": "independent"
}

4
lint-staged.config.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
'./src/**/**.{js,vue,jsx}': 'eslint',
'./src/**/**.{vue,js,ts,html,json,less}': 'prettier --write'
}

21
mockServer/.babelrc Normal file
View File

@ -0,0 +1,21 @@
{
"presets": [
["@babel/preset-env", {
"targets": {
"node": "current"
}
}]
],
"env": {
"test": {
"presets": [
["@babel/preset-env", {
"targets": {
"node": "current"
}
}]
]
}
},
"plugins": ["@babel/plugin-transform-runtime"]
}

9
mockServer/.editorconfig Normal file
View File

@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

3
mockServer/.eslintignore Normal file
View File

@ -0,0 +1,3 @@
build/*.js
assets/*.js
test/**/*.js

36
mockServer/.eslintrc.js Normal file
View File

@ -0,0 +1,36 @@
/**
* 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 = {
root: true,
parserOptions: {
parser: 'babel-eslint',
ecmaVersion: 2017, //指定ECMAScript支持的版本6为ES6这里为了兼容async和await设置为2017
sourceType: 'module'
},
extends: 'standard',
plugins: ['html', 'promise'],
env: {
node: true
},
rules: {
// allow console
'no-console': 0,
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': 0,
camelcase: 'off'
}
}

9
mockServer/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
.DS_Store
node_modules/
dist/
npm-debug.log
test/unit/coverage
test/e2e/reports
selenium-debug.log
.idea/
package-lock.json

11
mockServer/.jsbeautifyrc Normal file
View File

@ -0,0 +1,11 @@
{
"indent_size": 2,
"indent_char": " ",
"other": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 2,
"jslint_happy": true,
"indent_handlebars": true
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,95 @@
/**
* 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 { defineCustomElement } from '@opentiny/tiny-engine-webcomponent-core'
import * as vue from 'vue'
import { resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, toDisplayString } from 'vue'
import { I18nInjectionKey } from 'vue-i18n'
import { IconChevronLeft } from '@opentiny/vue-icon'
Object.freeze({})
Object.freeze([])
const cacheStringFunction = (fn) => {
const cache = /* @__PURE__ */ Object.create(null)
return (str) => {
const hit = cache[str]
return hit || (cache[str] = fn(str))
}
}
const hyphenateRE = /\B([A-Z])/g
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase())
var _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc
for (const [key, val] of props) {
target[key] = val
}
return target
}
const _sfc_main = {
components: {
TinyIconChevronLeft: IconChevronLeft()
},
props: {
blockName: { type: String, default: 'MT0526-React 1.0' }
},
setup(props, context) {
const { t, lowcodeWrap } = vue.inject(I18nInjectionKey).lowcode()
const wrap = lowcodeWrap(props, context, t)
const state = vue.reactive({})
const attrs = wrap({
state
})
return attrs
}
}
const _hoisted_1 = {
style: { 'font-size': '18px', height: '40px', 'border-bottom': '1px solid rgb(223, 225, 230)', 'margin-top': '20px' }
}
const _hoisted_2 = /* @__PURE__ */ createElementVNode(
'span',
{ style: { 'margin-left': '10px', 'font-weight': 'bold' } },
'\u7F16\u8F91\u7269\u6599\u8D44\u4EA7\u5305 | ',
-1
)
const _hoisted_3 = { style: { 'margin-left': '10px', 'font-weight': 'bold' } }
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_tiny_icon_chevron_left = resolveComponent('tiny-icon-chevron-left')
return (
openBlock(),
createElementBlock('div', null, [
createElementVNode('div', _hoisted_1, [
createVNode(_component_tiny_icon_chevron_left),
_hoisted_2,
createElementVNode('span', _hoisted_3, toDisplayString($props.blockName), 1)
])
])
)
}
var block = /* @__PURE__ */ _export_sfc(_sfc_main, [
['render', _sfc_render],
['__file', 'D:/tmp/buildground/buildground_1673597935715/src/block/generated/components/PortalBlock.vue']
])
window.TinyLowcodeResource = window.TinyLowcodeResource || {}
const blockName = hyphenate('PortalBlock')
block.blockId = 1005
block.blockVersion = '1.0.0'
if (customElements.get(blockName)) {
if (window.TinyLowcodeResource[blockName]) {
Object.assign(window.TinyLowcodeResource[blockName], block)
}
} else {
block.links = {
VUE_APP_UI_LIB_FULL_STYLE_FILE_URL: ['//localhost:9090/assets/css/0.1.20/index.css']
}.VUE_APP_UI_LIB_FULL_STYLE_FILE_URL
window.TinyLowcodeResource[blockName] = block
customElements.define(blockName, defineCustomElement(block))
}
export { block as default }

View File

@ -0,0 +1,135 @@
/**
* 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 (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined'
? (module.exports = factory(
require('@opentiny/tiny-engine-webcomponent-core'),
require('vue'),
require('vue-i18n'),
require('@opentiny/vue-icon')
))
: typeof define === 'function' && define.amd
? define(['@opentiny/tiny-engine-webcomponent-core', 'vue', 'vue-i18n', '@opentiny/vue-icon'], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.TinyVueBlock = factory(global.TinyWebcomponentCore, global.Vue, global.VueI18n, global.TinyVueIcon)))
})(this, function (tinyWebcomponentCore, vue, vueI18n, tinyVue3Icon) {
function _interopNamespace(e) {
if (e && e.__esModule) return e
var n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } })
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k)
Object.defineProperty(
n,
k,
d.get
? d
: {
enumerable: true,
get: function () {
return e[k]
}
}
)
}
})
}
n['default'] = e
return Object.freeze(n)
}
var vue__namespace = /* @__PURE__ */ _interopNamespace(vue)
Object.freeze({})
Object.freeze([])
const cacheStringFunction = (fn) => {
const cache = /* @__PURE__ */ Object.create(null)
return (str) => {
const hit = cache[str]
return hit || (cache[str] = fn(str))
}
}
const hyphenateRE = /\B([A-Z])/g
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase())
var _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc
for (const [key, val] of props) {
target[key] = val
}
return target
}
const _sfc_main = {
components: {
TinyIconChevronLeft: tinyVue3Icon.IconChevronLeft()
},
props: {
blockName: { type: String, default: 'MT0526-React 1.0' }
},
setup(props, context) {
const { t, lowcodeWrap } = vue__namespace.inject(vueI18n.I18nInjectionKey).lowcode()
const wrap = lowcodeWrap(props, context, t)
const state = vue__namespace.reactive({})
const attrs = wrap({
state
})
return attrs
}
}
const _hoisted_1 = {
style: {
'font-size': '18px',
height: '40px',
'border-bottom': '1px solid rgb(223, 225, 230)',
'margin-top': '20px'
}
}
const _hoisted_2 = /* @__PURE__ */ vue.createElementVNode(
'span',
{ style: { 'margin-left': '10px', 'font-weight': 'bold' } },
'\u7F16\u8F91\u7269\u6599\u8D44\u4EA7\u5305 | ',
-1
)
const _hoisted_3 = { style: { 'margin-left': '10px', 'font-weight': 'bold' } }
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_tiny_icon_chevron_left = vue.resolveComponent('tiny-icon-chevron-left')
return (
vue.openBlock(),
vue.createElementBlock('div', null, [
vue.createElementVNode('div', _hoisted_1, [
vue.createVNode(_component_tiny_icon_chevron_left),
_hoisted_2,
vue.createElementVNode('span', _hoisted_3, vue.toDisplayString($props.blockName), 1)
])
])
)
}
var block = /* @__PURE__ */ _export_sfc(_sfc_main, [
['render', _sfc_render],
['__file', 'D:/tmp/buildground/buildground_1673597935715/src/block/generated/components/PortalBlock.vue']
])
window.TinyLowcodeResource = window.TinyLowcodeResource || {}
const blockName = hyphenate('PortalBlock')
block.blockId = 1005
block.blockVersion = '1.0.0'
if (customElements.get(blockName)) {
if (window.TinyLowcodeResource[blockName]) {
Object.assign(window.TinyLowcodeResource[blockName], block)
}
} else {
block.links = {
VUE_APP_UI_LIB_FULL_STYLE_FILE_URL: ['//localhost:9090/assets/css/0.1.20/index.css']
}.VUE_APP_UI_LIB_FULL_STYLE_FILE_URL
window.TinyLowcodeResource[blockName] = block
customElements.define(blockName, tinyWebcomponentCore.defineCustomElement(block))
}
return block
})

View File

@ -0,0 +1,81 @@
/**
* 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 {
CarouselItem,
CheckboxButton,
Tree,
Popover,
Tooltip,
Col,
DropdownItem,
Pager,
Search,
Row,
FormItem,
Alert,
Input,
Tabs,
DropdownMenu,
DialogBox,
Switch,
TimeLine,
TabItem,
Radio,
Form,
Grid,
Numeric,
CheckboxGroup,
Select,
ButtonGroup,
Carousel,
Popeditor,
DatePicker,
Dropdown,
ChartHistogram
} from '@opentiny/vue'
const Mapper = {
TinyCarouselItem: CarouselItem,
TinyCheckboxButton: CheckboxButton,
TinyTree: Tree,
TinyPopover: Popover,
TinyTooltip: Tooltip,
TinyCol: Col,
TinyDropdownItem: DropdownItem,
TinyPager: Pager,
TinySearch: Search,
TinyRow: Row,
TinyFormItem: FormItem,
TinyAlert: Alert,
TinyInput: Input,
TinyTabs: Tabs,
TinyDropdownMenu: DropdownMenu,
TinyDialogBox: DialogBox,
TinySwitch: Switch,
TinyTimeLine: TimeLine,
TinyTabItem: TabItem,
TinyRadio: Radio,
TinyForm: Form,
TinyGrid: Grid,
TinyNumeric: Numeric,
TinyCheckboxGroup: CheckboxGroup,
TinySelect: Select,
TinyButtonGroup: ButtonGroup,
TinyCarousel: Carousel,
TinyPopeditor: Popeditor,
TinyDatePicker: DatePicker,
TinyDropdown: Dropdown,
TinyChartHistogram: ChartHistogram
}
Mapper['TinyTabs'].isGroup = true
Mapper['TinyGrid'].isGroup = true
export { Mapper as default }

View File

@ -0,0 +1,58 @@
/**
* 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 (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined'
? (module.exports = factory(require('@opentiny/vue')))
: typeof define === 'function' && define.amd
? define(['@opentiny/vue'], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.TinyLowcodeComponent = factory(global.TinyVue)))
})(this, function (tinyVue3) {
'use strict'
const Mapper = {
TinyCarouselItem: tinyVue3.CarouselItem,
TinyCheckboxButton: tinyVue3.CheckboxButton,
TinyTree: tinyVue3.Tree,
TinyPopover: tinyVue3.Popover,
TinyTooltip: tinyVue3.Tooltip,
TinyCol: tinyVue3.Col,
TinyDropdownItem: tinyVue3.DropdownItem,
TinyPager: tinyVue3.Pager,
TinySearch: tinyVue3.Search,
TinyRow: tinyVue3.Row,
TinyFormItem: tinyVue3.FormItem,
TinyAlert: tinyVue3.Alert,
TinyInput: tinyVue3.Input,
TinyTabs: tinyVue3.Tabs,
TinyDropdownMenu: tinyVue3.DropdownMenu,
TinyDialogBox: tinyVue3.DialogBox,
TinySwitch: tinyVue3.Switch,
TinyTimeLine: tinyVue3.TimeLine,
TinyTabItem: tinyVue3.TabItem,
TinyRadio: tinyVue3.Radio,
TinyForm: tinyVue3.Form,
TinyGrid: tinyVue3.Grid,
TinyNumeric: tinyVue3.Numeric,
TinyCheckboxGroup: tinyVue3.CheckboxGroup,
TinySelect: tinyVue3.Select,
TinyButtonGroup: tinyVue3.ButtonGroup,
TinyCarousel: tinyVue3.Carousel,
TinyPopeditor: tinyVue3.Popeditor,
TinyDatePicker: tinyVue3.DatePicker,
TinyDropdown: tinyVue3.Dropdown,
TinyChartHistogram: tinyVue3.ChartHistogram
}
Mapper['TinyTabs'].isGroup = true
Mapper['TinyGrid'].isGroup = true
return Mapper
})

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,664 @@
/**
* 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 { defineCustomElement } from '@opentiny/tiny-engine-webcomponent-core'
import * as vue from 'vue'
import {
resolveComponent,
openBlock,
createElementBlock,
createElementVNode,
Fragment,
renderList,
toDisplayString,
normalizeClass,
createVNode,
withCtx,
createBlock,
createCommentVNode,
pushScopeId,
popScopeId
} from 'vue'
import { I18nInjectionKey } from 'vue-i18n'
import { IconCheckOut, IconDeltaDown, IconGroup, IconHelpQuery, IconSetting, IconYes } from '@opentiny/vue-icon'
import { Popover, Tooltip } from '@opentiny/vue'
Object.freeze({})
Object.freeze([])
const cacheStringFunction = (fn) => {
const cache = /* @__PURE__ */ Object.create(null)
return (str) => {
const hit = cache[str]
return hit || (cache[str] = fn(str))
}
}
const hyphenateRE = /\B([A-Z])/g
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase())
var _style_0 =
'\n.team-list-item.active[data-v-b66e3972] {\r\n border: 1px solid #38acff;\n}\n.toolbars-item[data-v-b66e3972]:hover {\r\n cursor: pointer;\r\n background-color: #f1f2f3;\n}\n.toolbars-item.active[data-v-b66e3972] {\r\n background-color: #e5e6e8;\n}\n'
var _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc
for (const [key, val] of props) {
target[key] = val
}
return target
}
const _sfc_main = {
components: {
TinyIconCheckOut: IconCheckOut(),
TinyIconDeltaDown: IconDeltaDown(),
TinyIconGroup: IconGroup(),
TinyIconHelpQuery: IconHelpQuery(),
TinyIconSetting: IconSetting(),
TinyIconYes: IconYes(),
TinyPopover: Popover,
TinyTooltip: Tooltip
},
props: {
tenant: { type: Object, default: () => "{tenant_id: 'public'}" }
},
emits: ['handle-route'],
setup(props, context) {
const { t, lowcodeWrap } = vue.inject(I18nInjectionKey).lowcode()
const wrap = lowcodeWrap(props, context, t)
const state = vue.reactive({
menuData: [
{
label: '\u9996\u9875',
url: '/home'
},
{
label: '\u6211\u7684\u5E94\u7528',
url: '/home'
},
{
label: '\u5E94\u7528\u4E2D\u5FC3',
url: '/home'
},
{
label: '\u6211\u7684\u5E73\u53F0',
url: '/home'
},
{
label: '\u5E73\u53F0\u4E2D\u5FC3',
url: '/home'
},
{
label: '\u6211\u7684\u7269\u6599',
url: '/home'
},
{
label: '\u751F\u6001\u4E2D\u5FC3',
url: '/home'
},
{
label: '\u76D1\u63A7\u4E2D\u5FC3',
url: '/home'
}
],
tenants: [
{
id: 1,
tenant_id: 'public',
name_cn: '\u516C\u5171\u79DF\u6237',
name_en: 'Public Tenant',
description: 'Default tenant for new user to explore.',
published_at: '2021-12-28T11:39:10.000Z',
created_by: null,
updated_by: null,
created_at: '2021-12-28T11:39:10.000Z',
updated_at: '2022-06-27T03:52:15.000Z',
createdBy: null
},
{
id: 2,
tenant_id: 'crm',
name_cn: '\u5BA2\u6237\u5173\u7CFB\u7BA1\u7406\u7CFB\u7EDF',
name_en: 'Cloud CRM',
description: null,
published_at: '2021-12-30T07:39:19.000Z',
created_by: null,
created_at: '2021-12-30T14:41:57.000Z',
updated_at: '2022-06-14T06:28:08.000Z',
createdBy: null
},
{
id: 3,
tenant_id: 'tinyMock',
name_cn: 'mock\u5E73\u53F0',
name_en: null,
description: null,
published_at: '2022-05-26T07:13:28.000Z',
created_by: null,
updated_by: null,
created_at: '2022-05-26T07:13:29.000Z',
updated_at: '2022-05-26T07:13:29.000Z',
createdBy: null,
updatedBy: null
},
{
id: 4,
tenant_id: 'tinyStage',
name_cn: '\u5F00\u53D1\u5DE5\u5177\u96C6',
name_en: 'toolkits',
description: null,
published_at: '2022-05-18T07:56:55.000Z',
created_by: null,
updated_by: null,
created_at: '2022-05-18T07:56:55.000Z',
updated_at: '2022-05-18T07:56:55.000Z'
},
{
id: 5,
tenant_id: 'tinyUI',
name_cn: 'UI\u7EC4\u4EF6',
name_en: 'components',
description: null,
published_at: '2022-05-18T08:29:32.000Z',
created_by: null,
updated_by: null,
created_at: '2022-05-18T08:29:32.000Z',
updated_at: '2022-05-18T08:29:33.000Z'
},
{
id: 6,
tenant_id: 'tinyGate',
name_cn: '\u95E8\u7981\u7CFB\u7EDF',
name_en: 'gate',
description: null,
published_at: '2022-06-23T10:15:42.000Z',
created_by: null,
updated_by: null,
created_at: '2022-05-23T10:40:14.000Z',
updated_at: '2022-05-23T10:40:14.000Z',
createdBy: null,
updatedBy: null
},
{
id: 7,
tenant_id: 'guestGroup',
name_cn: '\u6E38\u5BA2\u56E2\u961F',
name_en: 'guest',
description: null,
published_at: '2022-06-23T10:15:38.000Z',
created_by: null,
updated_by: null,
created_at: '2022-06-22T14:58:22.000Z',
updated_at: '2022-06-22T14:58:22.000Z'
},
{
id: 265,
tenant_id: 'myteam',
name_cn: null,
name_en: null,
description: null,
published_at: '2022-06-14T06:49:58.000Z',
created_by: null,
updated_by: null,
created_at: '2022-06-14T06:49:58.000Z',
updated_at: '2022-06-14T06:49:58.000Z'
},
{
id: 267,
tenant_id: 'test',
name_cn: null,
name_en: null,
description: null,
published_at: '2022-06-15T03:35:14.000Z',
created_by: null,
updated_by: null,
created_at: '2022-06-15T03:35:14.000Z',
updated_at: '2022-06-15T03:35:14.000Z'
},
{
id: 268,
tenant_id: 'zzcTest',
name_cn: null,
name_en: null,
description: null,
published_at: '2022-06-17T08:47:17.000Z',
created_by: null,
updated_by: null,
created_at: '2022-06-17T08:47:17.000Z',
updated_at: '2022-06-17T08:47:17.000Z'
}
]
})
const openHomePage = wrap(function openHomePage2(event) {
this.router.push('/team-home')
})
const gotoRouter = wrap(function gotoRouter2(event) {
this.emit('handle-route', event)
})
const attrs = wrap({
state,
openHomePage,
gotoRouter
})
return attrs
}
}
const _withScopeId = (n) => (pushScopeId('data-v-b66e3972'), (n = n()), popScopeId(), n)
const _hoisted_1 = {
style: {
display: 'flex',
'justify-content': 'space-between',
'align-items': 'center',
height: '50px',
'border-radius': '0px'
}
}
const _hoisted_2 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ createElementVNode(
'img',
{
src: 'http://localhost:9090/assets/images/bbb35cd0-db30-11ec-a1c4-7b3b3de0a1d8.png',
style: { display: 'block', width: '48px', height: 'auto', 'margin-left': '10px' }
},
null,
-1
)
)
const _hoisted_3 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ createElementVNode('span', { style: { 'font-weight': 'bolder', color: '#000000' } }, 'TinyEngine', -1)
)
const _hoisted_4 = [_hoisted_2, _hoisted_3]
const _hoisted_5 = {
style: {
width: '230px',
height: '50px',
display: 'flex',
'justify-content': 'space-around',
'align-items': 'center',
'margin-right': '10px',
'border-radius': '0px'
},
class: 'toolbars'
}
const _hoisted_6 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ createElementVNode('div', { placeholder: '\u89E6\u53D1\u6E90' }, null, -1)
)
const _hoisted_7 = {
style: {
'padding-top': '6px',
'padding-left': '6px',
'padding-right': '6px',
'padding-bottom': '6px',
'margin-left': '8px',
'border-radius': '6px'
}
}
const _hoisted_8 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ createElementVNode('div', { placeholder: '\u89E6\u53D1\u6E90' }, null, -1)
)
const _hoisted_9 = {
style: {
'padding-top': '6px',
'padding-left': '6px',
'padding-right': '6px',
'padding-bottom': '6px',
'margin-left': '8px',
'border-radius': '6px'
}
}
const _hoisted_10 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ createElementVNode('div', { placeholder: '\u89E6\u53D1\u6E90' }, null, -1)
)
const _hoisted_11 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ createElementVNode(
'span',
{
class: 'split',
style: { margin: '0 8px', 'font-size': '16px', 'border-radius': '0px', color: '#e5e6e8' }
},
'|',
-1
)
)
const _hoisted_12 = { placeholder: '\u89E6\u53D1\u6E90' }
const _hoisted_13 = {
class: 'toolbars-item',
style: { padding: '6px', 'border-radius': '6px', display: 'flex', 'align-items': 'center' }
}
const _hoisted_14 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ createElementVNode('span', { style: { 'border-radius': '0px' } }, 'public', -1)
)
const _hoisted_15 = {
placeholder: '\u63D0\u793A\u5185\u5BB9',
style: { 'border-radius': '0px' }
}
const _hoisted_16 = {
style: { 'border-radius': '0px' },
class: 'team-list'
}
const _hoisted_17 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ createElementVNode(
'div',
{
class: 'team-list-title',
style: {
'font-size': '16px',
'line-height': '22px',
'font-weight': '500',
'text-overflow': 'ellipsis',
'white-space': 'nowrap',
overflow: 'hidden'
}
},
[/* @__PURE__ */ createElementVNode('span', null, '\u7EC4\u7EC7/\u56E2\u961F')],
-1
)
)
const _hoisted_18 = {
class: 'team-list-group',
style: { height: 'auto', 'max-height': '335px', overflow: 'auto', 'margin-top': '16px', 'border-radius': '0px' }
}
const _hoisted_19 = {
class: 'team-list-item-logo',
style: {
height: '28px',
width: '28px',
'border-radius': '8px',
'font-size': '16px',
color: '#fff',
background: '#38acff',
'margin-right': '12px',
display: 'flex',
'align-items': 'center',
'justify-content': 'center'
}
}
const _hoisted_20 = {
style: {
height: '22px',
'font-size': '14px',
'line-height': '22px',
color: 'rgba(0, 0, 0, 0.8)',
flex: '1',
'margin-right': '5px',
overflow: 'hidden',
'text-overflow': 'ellipsis',
'white-space': 'nowrap',
'border-radius': '0px'
}
}
const _hoisted_21 = {
style: { 'border-radius': '0px' },
class: 'team-list-item-icon'
}
const _hoisted_22 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ createElementVNode(
'img',
{
style: { width: '40px', height: 'auto', 'border-radius': '50px' },
src: 'https://localhost:9090/assets/images/120'
},
null,
-1
)
)
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
var _a
const _component_tiny_icon_setting = resolveComponent('tiny-icon-setting')
const _component_tiny_tooltip = resolveComponent('tiny-tooltip')
const _component_tiny_icon_check_out = resolveComponent('tiny-icon-check-out')
const _component_tiny_icon_help_query = resolveComponent('tiny-icon-help-query')
const _component_tiny_icon_delta_down = resolveComponent('tiny-icon-delta-down')
const _component_tiny_icon_group = resolveComponent('tiny-icon-group')
const _component_tiny_icon_yes = resolveComponent('tiny-icon-yes')
const _component_tiny_popover = resolveComponent('tiny-popover')
return (
openBlock(),
createElementBlock('div', null, [
createElementVNode('div', _hoisted_1, [
createElementVNode(
'div',
{
style: { display: 'flex', 'align-items': 'center', 'border-radius': '0px' },
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.openHomePage(_ctx.event))
},
_hoisted_4
),
createElementVNode('div', null, [
(openBlock(true),
createElementBlock(
Fragment,
null,
renderList(_ctx.state.menuData, (item, index) => {
return (
openBlock(),
createElementBlock(
'span',
{
key: index,
style: { 'font-size': '16px', 'margin-left': '10px', 'margin-right': '10px', color: '#747677' },
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.gotoRouter(_ctx.event))
},
toDisplayString(item.label),
1
)
)
}),
128
))
]),
createElementVNode('div', _hoisted_5, [
createElementVNode(
'div',
{
class: normalizeClass({
'toolbars-item': true,
active: ((_a = _ctx.route.path) == null ? void 0 : _a.indexOf('/permission-setting')) > -1
}),
style: {
'padding-top': '6px',
'padding-left': '6px',
'padding-right': '6px',
'padding-bottom': '6px',
'margin-left': '8px',
'border-radius': '6px'
},
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.openPermission(_ctx.event))
},
[
createVNode(
_component_tiny_tooltip,
{
content: '\u8BBE\u7F6E\u4E2D\u5FC3',
placement: 'top',
manual: false,
modelValue: true,
style: { color: '#878f95' }
},
{
default: withCtx(() => [_hoisted_6, createVNode(_component_tiny_icon_setting)]),
_: 1
}
)
],
2
),
createElementVNode('div', _hoisted_7, [
createVNode(
_component_tiny_tooltip,
{
content: '\u534F\u8BAE\u89C4\u8303',
placement: 'top',
manual: false,
modelValue: true,
style: { 'border-radius': '0px' }
},
{
default: withCtx(() => [
_hoisted_8,
createVNode(_component_tiny_icon_check_out, { style: { color: '#878f95' } })
]),
_: 1
}
)
]),
createElementVNode('div', _hoisted_9, [
createVNode(
_component_tiny_tooltip,
{
content: '\u5E2E\u52A9\u4E2D\u5FC3',
placement: 'top',
manual: false,
modelValue: true,
class: 'tip-icon',
style: { fill: '#878f95', 'border-radius': '0px' }
},
{
default: withCtx(() => [
_hoisted_10,
createVNode(_component_tiny_icon_help_query, { style: { color: '#ffffff' } })
]),
_: 1
}
)
]),
_hoisted_11,
createVNode(
_component_tiny_popover,
{
width: 308,
title: '\u5F39\u6846\u6807\u9898',
trigger: 'manual',
modelValue: true,
placement: 'bottom-end',
'popper-class': 'team-list-pop',
style: { 'border-radius': '0px' }
},
{
reference: withCtx(() => [
createElementVNode('div', _hoisted_12, [
createElementVNode('div', _hoisted_13, [
_hoisted_14,
createVNode(_component_tiny_icon_delta_down, {
style: { 'font-size': '12px', 'border-radius': '0px', color: '#878f95' }
})
])
])
]),
default: withCtx(() => [
createElementVNode('div', _hoisted_15, [
createElementVNode('div', _hoisted_16, [
_hoisted_17,
createElementVNode('div', _hoisted_18, [
(openBlock(true),
createElementBlock(
Fragment,
null,
renderList(_ctx.state.tenants, (item, index) => {
return (
openBlock(),
createElementBlock(
'div',
{
class: normalizeClass(['team-list-item', { active: item.id === $props.tenant.id }]),
key: item.id,
style: {
display: 'flex',
'align-items': 'center',
height: '56px',
'border-radius': '6px',
'background-color': '#fff',
cursor: 'pointer',
padding: '8px 12px',
'box-sizing': 'border-box'
}
},
[
createElementVNode('div', _hoisted_19, [
createVNode(_component_tiny_icon_group, { style: { 'border-radius': '0px' } })
]),
createElementVNode('span', _hoisted_20, toDisplayString(item.tenant_id), 1),
createElementVNode('div', _hoisted_21, [
item.id === 1
? (openBlock(),
createBlock(_component_tiny_icon_yes, {
key: 0,
style: { 'font-size': '20px', color: '#38acff' }
}))
: createCommentVNode('v-if', true)
])
],
2
)
)
}),
128
))
])
])
])
]),
_: 1
}
),
createVNode(_component_tiny_popover, {
width: 200,
title: '\u5F39\u6846\u6807\u9898',
trigger: 'manual',
modelValue: false,
'append-to-body': false
}),
createVNode(_component_tiny_popover, {
width: 308,
title: '\u5F39\u6846\u6807\u9898',
trigger: 'click',
modelValue: false,
placement: 'bottom-end',
'append-to-body': false,
'visible-arrow': false,
'popper-class': 'team-list-pop'
}),
_hoisted_22
])
]),
createVNode(_component_tiny_popover, {
width: 200,
title: '\u5F39\u6846\u6807\u9898',
trigger: 'manual',
modelValue: true
}),
createVNode(_component_tiny_popover, {
width: 200,
title: '\u5F39\u6846\u6807\u9898',
trigger: 'manual',
modelValue: false,
'visible-arrow': true
})
])
)
}
var block = /* @__PURE__ */ _export_sfc(_sfc_main, [
['render', _sfc_render],
['styles', [_style_0]],
['__scopeId', 'data-v-b66e3972'],
['__file', 'D:/tmp/buildground/buildground_1673597845904/src/block/generated/components/PortalHeader.vue']
])
window.TinyLowcodeResource = window.TinyLowcodeResource || {}
const blockName = hyphenate('PortalHeader')
block.blockId = 998
block.blockVersion = '1.0.0'
if (customElements.get(blockName)) {
if (window.TinyLowcodeResource[blockName]) {
Object.assign(window.TinyLowcodeResource[blockName], block)
}
} else {
block.links = {
VUE_APP_UI_LIB_FULL_STYLE_FILE_URL: ['//localhost:9090/assets/css/0.1.20/index.css']
}.VUE_APP_UI_LIB_FULL_STYLE_FILE_URL
window.TinyLowcodeResource[blockName] = block
customElements.define(blockName, defineCustomElement(block))
}
export { block as default }

View File

@ -0,0 +1,713 @@
/**
* 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 (global, factory) {
typeof exports === 'object ' && typeof module !== 'undefined '
? (module.exports = factory(
require('@opentiny/tiny-engine-webcomponent-core '),
require('vue '),
require('vue-i18n '),
require('@opentiny/vue-icon '),
require('@opentiny/vue ')
))
: typeof define === 'function ' && define.amd
? define(
['@opentiny/tiny-engine-webcomponent-core ', 'vue ', 'vue-i18n ', '@opentiny/vue-icon ', '@opentiny/vue '],
factory
)
: ((global = typeof globalThis !== 'undefined ' ? globalThis : global || self),
(global.TinyVueBlock = factory(
global.TinyWebcomponentCore,
global.Vue,
global.VueI18n,
global.TinyVueIcon,
global.TinyVue
)))
})(this, function (tinyWebcomponentCore, vue, vueI18n, tinyVue3Icon, tinyVue3) {
'use strict '
function _interopNamespace(e) {
if (e && e.__esModule) return e
var n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module ' } })
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default ') {
var d = Object.getOwnPropertyDescriptor(e, k)
Object.defineProperty(
n,
k,
d.get
? d
: {
enumerable: true,
get: function () {
return e[k]
}
}
)
}
})
}
n['default '] = e
return Object.freeze(n)
}
var vue__namespace = /* @__PURE__ */ _interopNamespace(vue)
Object.freeze({})
Object.freeze([])
const cacheStringFunction = (fn) => {
const cache = /* @__PURE__ */ Object.create(null)
return (str) => {
const hit = cache[str]
return hit || (cache[str] = fn(str))
}
}
const hyphenateRE = /\B([A-Z])/g
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1 ').toLowerCase())
var _style_0 =
'\n.team-list-item.active[data-v-b66e3972] {\r\n border: 1px solid #38acff;\n}\n.toolbars-item[data-v-b66e3972]:hover {\r\n cursor: pointer;\r\n background-color: #f1f2f3;\n}\n.toolbars-item.active[data-v-b66e3972] {\r\n background-color: #e5e6e8;\n}\n '
var _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc
for (const [key, val] of props) {
target[key] = val
}
return target
}
const _sfc_main = {
components: {
TinyIconCheckOut: tinyVue3Icon.IconCheckOut(),
TinyIconDeltaDown: tinyVue3Icon.IconDeltaDown(),
TinyIconGroup: tinyVue3Icon.IconGroup(),
TinyIconHelpQuery: tinyVue3Icon.IconHelpQuery(),
TinyIconSetting: tinyVue3Icon.IconSetting(),
TinyIconYes: tinyVue3Icon.IconYes(),
TinyPopover: tinyVue3.Popover,
TinyTooltip: tinyVue3.Tooltip
},
props: {
tenant: { type: Object, default: () => "{tenant_id: 'public'} " }
},
emits: ['handle-route '],
setup(props, context) {
const { t, lowcodeWrap } = vue__namespace.inject(vueI18n.I18nInjectionKey).lowcode()
const wrap = lowcodeWrap(props, context, t)
const state = vue__namespace.reactive({
'menuData ': [
{
'label ': '\u9996\u9875 ',
'url ': '/home '
},
{
'label ': '\u6211\u7684\u5E94\u7528 ',
'url ': '/home '
},
{
'label ': '\u5E94\u7528\u4E2D\u5FC3 ',
'url ': '/home '
},
{
'label ': '\u6211\u7684\u5E73\u53F0 ',
'url ': '/home '
},
{
'label ': '\u5E73\u53F0\u4E2D\u5FC3 ',
'url ': '/home '
},
{
'label ': '\u6211\u7684\u7269\u6599 ',
'url ': '/home '
},
{
'label ': '\u751F\u6001\u4E2D\u5FC3 ',
'url ': '/home '
},
{
'label ': '\u76D1\u63A7\u4E2D\u5FC3 ',
'url ': '/home '
}
],
'tenants ': [
{
'id ': 1,
'tenant_id ': 'public ',
'name_cn ': '\u516C\u5171\u79DF\u6237 ',
'name_en ': 'Public Tenant ',
'description ': 'Default tenant for new user to explore. ',
'published_at ': '2021-12-28T11:39:10.000Z ',
'created_by ': null,
'updated_by ': null,
'created_at ': '2021-12-28T11:39:10.000Z ',
'updated_at ': '2022-06-27T03:52:15.000Z ',
'createdBy ': null
},
{
'id ': 2,
'tenant_id ': 'crm ',
'name_cn ': '\u5BA2\u6237\u5173\u7CFB\u7BA1\u7406\u7CFB\u7EDF ',
'name_en ': 'Cloud CRM ',
'description ': null,
'published_at ': '2021-12-30T07:39:19.000Z ',
'created_by ': null,
'created_at ': '2021-12-30T14:41:57.000Z ',
'updated_at ': '2022-06-14T06:28:08.000Z ',
'createdBy ': null
},
{
'id ': 3,
'tenant_id ': 'tinyMock ',
'name_cn ': 'mock\u5E73\u53F0 ',
'name_en ': null,
'description ': null,
'published_at ': '2022-05-26T07:13:28.000Z ',
'created_by ': null,
'updated_by ': null,
'created_at ': '2022-05-26T07:13:29.000Z ',
'updated_at ': '2022-05-26T07:13:29.000Z ',
'createdBy ': null,
'updatedBy ': null
},
{
'id ': 4,
'tenant_id ': 'tinyStage ',
'name_cn ': '\u5F00\u53D1\u5DE5\u5177\u96C6 ',
'name_en ': 'toolkits ',
'description ': null,
'published_at ': '2022-05-18T07:56:55.000Z ',
'created_by ': null,
'updated_by ': null,
'created_at ': '2022-05-18T07:56:55.000Z ',
'updated_at ': '2022-05-18T07:56:55.000Z '
},
{
'id ': 5,
'tenant_id ': 'tinyUI ',
'name_cn ': 'UI\u7EC4\u4EF6 ',
'name_en ': 'components ',
'description ': null,
'published_at ': '2022-05-18T08:29:32.000Z ',
'created_by ': null,
'updated_by ': null,
'created_at ': '2022-05-18T08:29:32.000Z ',
'updated_at ': '2022-05-18T08:29:33.000Z '
},
{
'id ': 6,
'tenant_id ': 'tinyGate ',
'name_cn ': '\u95E8\u7981\u7CFB\u7EDF ',
'name_en ': 'gate ',
'description ': null,
'published_at ': '2022-06-23T10:15:42.000Z ',
'created_by ': null,
'updated_by ': null,
'created_at ': '2022-05-23T10:40:14.000Z ',
'updated_at ': '2022-05-23T10:40:14.000Z ',
'createdBy ': null,
'updatedBy ': null
},
{
'id ': 7,
'tenant_id ': 'guestGroup ',
'name_cn ': '\u6E38\u5BA2\u56E2\u961F ',
'name_en ': 'guest ',
'description ': null,
'published_at ': '2022-06-23T10:15:38.000Z ',
'created_by ': null,
'updated_by ': null,
'created_at ': '2022-06-22T14:58:22.000Z ',
'updated_at ': '2022-06-22T14:58:22.000Z '
},
{
'id ': 265,
'tenant_id ': 'myteam ',
'name_cn ': null,
'name_en ': null,
'description ': null,
'published_at ': '2022-06-14T06:49:58.000Z ',
'created_by ': null,
'updated_by ': null,
'created_at ': '2022-06-14T06:49:58.000Z ',
'updated_at ': '2022-06-14T06:49:58.000Z '
},
{
'id ': 267,
'tenant_id ': 'test ',
'name_cn ': null,
'name_en ': null,
'description ': null,
'published_at ': '2022-06-15T03:35:14.000Z ',
'created_by ': null,
'updated_by ': null,
'created_at ': '2022-06-15T03:35:14.000Z ',
'updated_at ': '2022-06-15T03:35:14.000Z '
},
{
'id ': 268,
'tenant_id ': 'zzcTest ',
'name_cn ': null,
'name_en ': null,
'description ': null,
'published_at ': '2022-06-17T08:47:17.000Z ',
'created_by ': null,
'updated_by ': null,
'created_at ': '2022-06-17T08:47:17.000Z ',
'updated_at ': '2022-06-17T08:47:17.000Z '
}
]
})
const openHomePage = wrap(function openHomePage2(event) {
this.router.push('/team-home ')
})
const gotoRouter = wrap(function gotoRouter2(event) {
this.emit('handle-route ', event)
})
const attrs = wrap({
state,
openHomePage,
gotoRouter
})
return attrs
}
}
const _withScopeId = (n) => (vue.pushScopeId('data-v-b66e3972 '), (n = n()), vue.popScopeId(), n)
const _hoisted_1 = {
style: {
'display ': 'flex ',
'justify-content ': 'space-between ',
'align-items ': 'center ',
'height ': '50px ',
'border-radius ': '0px '
}
}
const _hoisted_2 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ vue.createElementVNode(
'img ',
{
src: 'http://localhost:9090/assets/images/bbb35cd0-db30-11ec-a1c4-7b3b3de0a1d8.png ',
style: { 'display ': 'block ', 'width ': '48px ', 'height ': 'auto ', 'margin-left ': '10px ' }
},
null,
-1
)
)
const _hoisted_3 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ vue.createElementVNode(
'span ',
{ style: { 'font-weight ': 'bolder ', 'color ': '#000000 ' } },
'TinyEngine ',
-1
)
)
const _hoisted_4 = [_hoisted_2, _hoisted_3]
const _hoisted_5 = {
style: {
'width ': '230px ',
'height ': '50px ',
'display ': 'flex ',
'justify-content ': 'space-around ',
'align-items ': 'center ',
'margin-right ': '10px ',
'border-radius ': '0px '
},
class: 'toolbars '
}
const _hoisted_6 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ vue.createElementVNode('div ', { placeholder: '\u89E6\u53D1\u6E90 ' }, null, -1)
)
const _hoisted_7 = {
style: {
'padding-top ': '6px ',
'padding-left ': '6px ',
'padding-right ': '6px ',
'padding-bottom ': '6px ',
'margin-left ': '8px ',
'border-radius ': '6px '
}
}
const _hoisted_8 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ vue.createElementVNode('div ', { placeholder: '\u89E6\u53D1\u6E90 ' }, null, -1)
)
const _hoisted_9 = {
style: {
'padding-top ': '6px ',
'padding-left ': '6px ',
'padding-right ': '6px ',
'padding-bottom ': '6px ',
'margin-left ': '8px ',
'border-radius ': '6px '
}
}
const _hoisted_10 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ vue.createElementVNode('div ', { placeholder: '\u89E6\u53D1\u6E90 ' }, null, -1)
)
const _hoisted_11 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ vue.createElementVNode(
'span ',
{
class: 'split ',
style: { 'margin ': '0 8px ', 'font-size ': '16px ', 'border-radius ': '0px ', 'color ': '#e5e6e8 ' }
},
'| ',
-1
)
)
const _hoisted_12 = { placeholder: '\u89E6\u53D1\u6E90 ' }
const _hoisted_13 = {
class: 'toolbars-item ',
style: { 'padding ': '6px ', 'border-radius ': '6px ', 'display ': 'flex ', 'align-items ': 'center ' }
}
const _hoisted_14 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ vue.createElementVNode('span ', { style: { 'border-radius ': '0px ' } }, 'public ', -1)
)
const _hoisted_15 = {
placeholder: '\u63D0\u793A\u5185\u5BB9 ',
style: { 'border-radius ': '0px ' }
}
const _hoisted_16 = {
style: { 'border-radius ': '0px ' },
class: 'team-list '
}
const _hoisted_17 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ vue.createElementVNode(
'div ',
{
class: 'team-list-title ',
style: {
'font-size ': '16px ',
'line-height ': '22px ',
'font-weight ': '500 ',
'text-overflow ': 'ellipsis ',
'white-space ': 'nowrap ',
'overflow ': 'hidden '
}
},
[/* @__PURE__ */ vue.createElementVNode('span ', null, '\u7EC4\u7EC7/\u56E2\u961F ')],
-1
)
)
const _hoisted_18 = {
class: 'team-list-group ',
style: {
'height ': 'auto ',
'max-height ': '335px ',
'overflow ': 'auto ',
'margin-top ': '16px ',
'border-radius ': '0px '
}
}
const _hoisted_19 = {
class: 'team-list-item-logo ',
style: {
'height ': '28px ',
'width ': '28px ',
'border-radius ': '8px ',
'font-size ': '16px ',
'color ': '#fff ',
'background ': '#38acff ',
'margin-right ': '12px ',
'display ': 'flex ',
'align-items ': 'center ',
'justify-content ': 'center '
}
}
const _hoisted_20 = {
style: {
'height ': '22px ',
'font-size ': '14px ',
'line-height ': '22px ',
'color ': 'rgba(0, 0, 0, 0.8) ',
'flex ': '1 ',
'margin-right ': '5px ',
'overflow ': 'hidden ',
'text-overflow ': 'ellipsis ',
'white-space ': 'nowrap ',
'border-radius ': '0px '
}
}
const _hoisted_21 = {
style: { 'border-radius ': '0px ' },
class: 'team-list-item-icon '
}
const _hoisted_22 = /* @__PURE__ */ _withScopeId(() =>
/* @__PURE__ */ vue.createElementVNode(
'img ',
{
style: { 'width ': '40px ', 'height ': 'auto ', 'border-radius ': '50px ' },
src: 'http://localhost:9090/assets/images/120 '
},
null,
-1
)
)
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
var _a
const _component_tiny_icon_setting = vue.resolveComponent('tiny-icon-setting ')
const _component_tiny_tooltip = vue.resolveComponent('tiny-tooltip ')
const _component_tiny_icon_check_out = vue.resolveComponent('tiny-icon-check-out ')
const _component_tiny_icon_help_query = vue.resolveComponent('tiny-icon-help-query ')
const _component_tiny_icon_delta_down = vue.resolveComponent('tiny-icon-delta-down ')
const _component_tiny_icon_group = vue.resolveComponent('tiny-icon-group ')
const _component_tiny_icon_yes = vue.resolveComponent('tiny-icon-yes ')
const _component_tiny_popover = vue.resolveComponent('tiny-popover ')
return (
vue.openBlock(),
vue.createElementBlock('div ', null, [
vue.createElementVNode('div ', _hoisted_1, [
vue.createElementVNode(
'div ',
{
style: { 'display ': 'flex ', 'align-items ': 'center ', 'border-radius ': '0px ' },
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.openHomePage(_ctx.event))
},
_hoisted_4
),
vue.createElementVNode('div ', null, [
(vue.openBlock(true),
vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(_ctx.state.menuData, (item, index) => {
return (
vue.openBlock(),
vue.createElementBlock(
'span ',
{
key: index,
style: {
'font-size ': '16px ',
'margin-left ': '10px ',
'margin-right ': '10px ',
'color ': '#747677 '
},
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.gotoRouter(_ctx.event))
},
vue.toDisplayString(item.label),
1
)
)
}),
128
))
]),
vue.createElementVNode('div ', _hoisted_5, [
vue.createElementVNode(
'div ',
{
class: vue.normalizeClass({
'toolbars-item ': true,
active: ((_a = _ctx.route.path) == null ? void 0 : _a.indexOf('/permission-setting ')) > -1
}),
style: {
'padding-top ': '6px ',
'padding-left ': '6px ',
'padding-right ': '6px ',
'padding-bottom ': '6px ',
'margin-left ': '8px ',
'border-radius ': '6px '
},
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.openPermission(_ctx.event))
},
[
vue.createVNode(
_component_tiny_tooltip,
{
content: '\u8BBE\u7F6E\u4E2D\u5FC3 ',
placement: 'top ',
manual: false,
modelValue: true,
style: { 'color ': '#878f95 ' }
},
{
default: vue.withCtx(() => [_hoisted_6, vue.createVNode(_component_tiny_icon_setting)]),
_: 1
}
)
],
2
),
vue.createElementVNode('div ', _hoisted_7, [
vue.createVNode(
_component_tiny_tooltip,
{
content: '\u534F\u8BAE\u89C4\u8303 ',
placement: 'top ',
manual: false,
modelValue: true,
style: { 'border-radius ': '0px ' }
},
{
default: vue.withCtx(() => [
_hoisted_8,
vue.createVNode(_component_tiny_icon_check_out, { style: { 'color ': '#878f95 ' } })
]),
_: 1
}
)
]),
vue.createElementVNode('div ', _hoisted_9, [
vue.createVNode(
_component_tiny_tooltip,
{
content: '\u5E2E\u52A9\u4E2D\u5FC3 ',
placement: 'top ',
manual: false,
modelValue: true,
class: 'tip-icon ',
style: { 'fill ': '#878f95 ', 'border-radius ': '0px ' }
},
{
default: vue.withCtx(() => [
_hoisted_10,
vue.createVNode(_component_tiny_icon_help_query, { style: { 'color ': '#ffffff ' } })
]),
_: 1
}
)
]),
_hoisted_11,
vue.createVNode(
_component_tiny_popover,
{
width: 308,
title: '\u5F39\u6846\u6807\u9898 ',
trigger: 'manual ',
modelValue: true,
placement: 'bottom-end ',
'popper-class ': 'team-list-pop ',
style: { 'border-radius ': '0px ' }
},
{
reference: vue.withCtx(() => [
vue.createElementVNode('div ', _hoisted_12, [
vue.createElementVNode('div ', _hoisted_13, [
_hoisted_14,
vue.createVNode(_component_tiny_icon_delta_down, {
style: { 'font-size ': '12px ', 'border-radius ': '0px ', 'color ': '#878f95 ' }
})
])
])
]),
default: vue.withCtx(() => [
vue.createElementVNode('div ', _hoisted_15, [
vue.createElementVNode('div ', _hoisted_16, [
_hoisted_17,
vue.createElementVNode('div ', _hoisted_18, [
(vue.openBlock(true),
vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(_ctx.state.tenants, (item, index) => {
return (
vue.openBlock(),
vue.createElementBlock(
'div ',
{
class: vue.normalizeClass([
'team-list-item ',
{ active: item.id === $props.tenant.id }
]),
key: item.id,
style: {
'display ': 'flex ',
'align-items ': 'center ',
'height ': '56px ',
'border-radius ': '6px ',
'background-color ': '#fff ',
'cursor ': 'pointer ',
'padding ': '8px 12px ',
'box-sizing ': 'border-box '
}
},
[
vue.createElementVNode('div ', _hoisted_19, [
vue.createVNode(_component_tiny_icon_group, { style: { 'border-radius ': '0px ' } })
]),
vue.createElementVNode('span ', _hoisted_20, vue.toDisplayString(item.tenant_id), 1),
vue.createElementVNode('div ', _hoisted_21, [
item.id === 1
? (vue.openBlock(),
vue.createBlock(_component_tiny_icon_yes, {
key: 0,
style: { 'font-size ': '20px ', 'color ': '#38acff ' }
}))
: vue.createCommentVNode('v-if ', true)
])
],
2
)
)
}),
128
))
])
])
])
]),
_: 1
}
),
vue.createVNode(_component_tiny_popover, {
width: 200,
title: '\u5F39\u6846\u6807\u9898 ',
trigger: 'manual ',
modelValue: false,
'append-to-body ': false
}),
vue.createVNode(_component_tiny_popover, {
width: 308,
title: '\u5F39\u6846\u6807\u9898 ',
trigger: 'click ',
modelValue: false,
placement: 'bottom-end ',
'append-to-body ': false,
'visible-arrow ': false,
'popper-class ': 'team-list-pop '
}),
_hoisted_22
])
]),
vue.createVNode(_component_tiny_popover, {
width: 200,
title: '\u5F39\u6846\u6807\u9898 ',
trigger: 'manual ',
modelValue: true
}),
vue.createVNode(_component_tiny_popover, {
width: 200,
title: '\u5F39\u6846\u6807\u9898 ',
trigger: 'manual ',
modelValue: false,
'visible-arrow ': true
})
])
)
}
var block = /* @__PURE__ */ _export_sfc(_sfc_main, [
['render ', _sfc_render],
['styles ', [_style_0]],
['__scopeId ', 'data-v-b66e3972 '],
['__file ', 'D:/tmp/buildground/buildground_1673597845904/src/block/generated/components/PortalHeader.vue ']
])
window.TinyLowcodeResource = window.TinyLowcodeResource || {}
const blockName = hyphenate('PortalHeader ')
block.blockId = 998
block.blockVersion = '1.0.0 '
if (customElements.get(blockName)) {
if (window.TinyLowcodeResource[blockName]) {
Object.assign(window.TinyLowcodeResource[blockName], block)
}
} else {
block.links = {
'VUE_APP_UI_LIB_FULL_STYLE_FILE_URL ': ['//localhost:9090/assets/css/0.1.20/index.css ']
}.VUE_APP_UI_LIB_FULL_STYLE_FILE_URL
window.TinyLowcodeResource[blockName] = block
customElements.define(blockName, tinyWebcomponentCore.defineCustomElement(block))
}
return block
})

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
1

View File

@ -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.
*
*/
require('@babel/register')
require('../src/app')

109
mockServer/gulpfile.js Normal file
View File

@ -0,0 +1,109 @@
/**
* 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 gulp = require('gulp')
const eslint = require('gulp-eslint')
const nodemon = require('gulp-nodemon')
const friendlyFormatter = require('eslint-friendly-formatter')
let jsScript = 'node'
if (process.env.npm_config_argv !== undefined && process.env.npm_config_argv.indexOf('debug') > 0) {
jsScript = 'node debug'
}
function lintOne(aims) {
return gulp
.src(aims)
.pipe(eslint({ configFile: './.eslintrc.js' }))
.pipe(eslint.format(friendlyFormatter))
.pipe(
eslint.results((results) => {
// Called once for all ESLint results.
})
)
}
gulp.task('ESlint', () => {
return gulp
.src(['src/**/*.js', '!node_modules/**'])
.pipe(eslint({ configFile: './.eslintrc.js' }))
.pipe(eslint.format(friendlyFormatter))
.pipe(eslint.results((results) => {}))
})
gulp.task(
'ESlint_nodemon',
gulp.series('ESlint', () => {
const stream = nodemon({
script: 'build/dev-server.js',
execMap: {
js: jsScript
},
tasks: function (changedFiles) {
lintOne(changedFiles)
return []
},
verbose: true,
ignore: ['build/*.js', 'dist/*.js', 'nodemon.json', '.git', 'node_modules/**/node_modules', 'gulpfile.js'],
env: {
NODE_ENV: 'development'
},
ext: 'js json'
})
return stream
.on('restart', () => {
// 重启项目
})
.on('crash', () => {
// 重启工程restart the server in 20 secondsstream.emit('restart', 20)
})
})
)
gulp.task('nodemon', () => {
return nodemon({
script: 'build/dev-server.js',
execMap: {
js: jsScript
},
verbose: true,
ignore: ['build/*.js', 'dist/*.js', 'nodemon.json', '.git', 'node_modules/**/node_modules', 'gulpfile.js'],
env: {
NODE_ENV: 'development'
},
ext: 'js json'
})
})
gulp.task('default', () => {
const stream = nodemon({
script: 'build/dev-server.js',
execMap: {
js: jsScript
},
verbose: true,
ignore: ['build/*.js', 'dist/*.js', 'nodemon.json', '.git', 'node_modules/**/node_modules', 'gulpfile.js'],
env: {
NODE_ENV: 'development'
},
ext: 'js json'
})
return stream
.on('restart', () => {
// 重启项目
})
.on('crash', () => {
// 重启工程restart the server in 20 secondsstream.emit('restart', 20)
})
})

1
mockServer/logs/out.log Normal file
View File

@ -0,0 +1 @@
ok

57
mockServer/package.json Normal file
View File

@ -0,0 +1,57 @@
{
"name": "koa2-mock",
"version": "1.0.0",
"description": "mock服务",
"author": "opentiny",
"license": "WTFPL",
"scripts": {
"start": "gulp nodemon",
"dev": "gulp",
"build": "babel src -d dist",
"production": "node dist/app.js",
"test": "jest",
"lint": "eslint --fix ."
},
"dependencies": {
"@opentiny/lowcode-dsl-vue": "0.4.0",
"@seald-io/nedb": "^4.0.2",
"fs-extra": "^11.1.1",
"glob": "^10.3.4",
"koa": "^2.11.0",
"koa-body": "^4.1.1",
"koa-compose": "^4.1.0",
"koa-jwt": "^3.6.0",
"koa-router": "^8.0.8",
"koa-static2": "^0.1.8"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/plugin-external-helpers": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.2",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^25.3.0",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.1",
"eslint-friendly-formatter": "^4.0.1",
"eslint-plugin-html": "^6.0.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jest": "^23.8.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"gulp": "^4.0.2",
"gulp-eslint": "^6.0.0",
"gulp-nodemon": "^2.5.0",
"jest": "^25.3.0",
"koa-logger": "^3.2.1"
},
"engines": {
"node": ">= 7.8.0",
"npm": ">= 4.2.0"
}
}

31
mockServer/pm2.js Normal file
View File

@ -0,0 +1,31 @@
/**
* 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 = {
apps: [
{
name: 'RESRful API Server',
script: './dist/app.js',
watch: false, // 默认关闭watch 可替换为 ['src']
ignoreWatch: ['node_modules', 'build', 'logs'],
outFile: '/logs/out.log', // 日志输出
errorFile: '/logs/error.log', // 错误日志
maxMemoryRestart: '2G', // 超过多大内存自动重启,仅防止内存泄露有意义,需要根据自己的业务设置
env: {
NODE_ENV: 'production'
},
execMode: 'cluster', // 开启多线程模式,用于负载均衡
instances: 'max', // 启用多少个实例,可用于负载均衡
autorestart: true // 程序崩溃后自动重启
}
]
}

62
mockServer/src/app.js Normal file
View File

@ -0,0 +1,62 @@
/**
* 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 Koa2 from 'koa'
import KoaBody from 'koa-body'
import KoaStatic from 'koa-static2'
import path from 'path'
import MainRoutes from './routes/main-routes'
import ErrorRoutesCatch from './middleware/ErrorRoutesCatch'
import ErrorRoutes from './routes/error-routes'
const app = new Koa2()
const env = process.env.NODE_ENV || 'development' // Current mode
const PORT = 9090
app
.use((ctx, next) => {
ctx.set('Access-Control-Allow-Origin', '*')
ctx.set('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
ctx.set('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS')
ctx.set('Access-Control-Allow-Credentials', true) // 允许带上 cookie
return next()
})
.use(ErrorRoutesCatch())
.use(KoaStatic('assets', path.resolve(__dirname, '../assets'))) // Static resource
.use(
KoaBody({
multipart: true,
parsedMethods: ['POST', 'PUT', 'PATCH', 'GET', 'HEAD', 'DELETE'], // parse GET, HEAD, DELETE requests
formidable: {
uploadDir: path.join(__dirname, '../assets/uploads/tmp')
},
jsonLimit: '50mb',
formLimit: '50mb',
textLimit: '50mb'
})
) // Processing request
.use(MainRoutes.routes())
.use(MainRoutes.allowedMethods())
.use(ErrorRoutes())
if (env === 'development') {
// logger
app.use((ctx, next) => {
const start = new Date()
return next().then(() => {
const ms = new Date() - start
})
})
}
app.listen(PORT)
export default app

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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 { getResponseData } = require('../tool/Common')
module.exports = function () {
return function (ctx, next) {
return next().catch((err) => {
ctx.status = 200
ctx.body = getResponseData(null, err)
})
}
}

View File

@ -0,0 +1,78 @@
{
"data": {
"id": 918,
"name": "portal-app",
"app_website": null,
"platform": {
"id": 897,
"name": "portal-platform"
},
"obs_url": "",
"created_by": null,
"updated_by": null,
"created_at": "2022-06-08T07:19:01.000Z",
"updated_at": "2023-09-04T08:55:40.000Z",
"state": null,
"published": false,
"createdBy": 86,
"updatedBy": 564,
"tenant": 1,
"home_page": "NTJ4MjvqoVj8OVsc",
"css": null,
"config": {},
"git_group": "",
"project_name": "",
"constants": null,
"data_handler": {
"type": "JSFunction",
"value": "function dataHanlder(res){\n return res;\n}"
},
"description": "demo应用",
"latest": 22,
"platform_history": null,
"editor_url": "",
"branch": "develop",
"visit_url": null,
"is_demo": null,
"image_url": "",
"is_default": true,
"template_type": null,
"set_template_time": null,
"set_template_by": null,
"set_default_by": 169,
"framework": "Vue",
"global_state": [],
"default_lang": null,
"extend_config": {
"business": {
"serviceName": "",
"endpointName": "cce",
"endpointId": "ee",
"serviceId": "ee",
"router": "ee"
},
"env": {
"alpha": {
"regions": [
{
"name": "",
"baseUrl": "",
"isDefault": false
}
],
"isDefault": true
}
},
"type": "console"
},
"assets_url": "",
"data_hash": "ae128e37f6bc378f1b9c21d75bd05551",
"can_associate": true,
"data_source_global": {
"dataHandler": {
"type": "JSFunction",
"value": "function dataHanlder(res){\n return res;\n}"
}
}
}
}

View File

@ -0,0 +1,20 @@
{
"data": {
"id": 245824,
"name": "Input",
"type": "npm",
"content": {
"package": "@opentiny/vue",
"version": "",
"exportName": "Input",
"subName": "",
"destructuring": true,
"main": ""
},
"app": 918,
"category": "utils",
"created_at": "2023-09-04T08:32:38.000Z",
"updated_at": "2023-09-04T08:32:38.000Z"
},
"locale": "zh-cn"
}

View File

@ -0,0 +1,127 @@
{
"data": [
{
"id": 176,
"name": "axios",
"type": "npm",
"content": {
"type": "JSFunction",
"value": "",
"package": "axios",
"destructuring": false,
"exportName": "axios"
},
"app": 918,
"category": "utils",
"created_at": "2022-10-27T11:02:26.000Z",
"updated_at": "2022-10-27T11:02:26.000Z"
},
{
"id": 104,
"name": "Button",
"type": "npm",
"content": {
"package": "@opentiny/vue",
"version": "",
"exportName": "Button",
"subName": "",
"destructuring": true,
"main": ""
},
"app": 918,
"category": "utils",
"created_at": "2022-07-06T10:17:31.000Z",
"updated_at": "2022-07-06T10:17:31.000Z"
},
{
"id": 101,
"name": "Menu",
"type": "npm",
"content": {
"type": "JSFunction",
"value": "",
"package": "@opentiny/vue",
"exportName": "NavMenu",
"destructuring": true
},
"app": 918,
"category": "utils",
"created_at": "2022-06-24T06:40:52.000Z",
"updated_at": "2022-06-24T08:03:13.000Z"
},
{
"id": 103,
"name": "Modal ",
"type": "npm",
"content": {
"package": "@opentiny/vue",
"version": "",
"exportName": "Modal ",
"subName": "",
"destructuring": true,
"main": ""
},
"app": 918,
"category": "utils",
"created_at": "2022-07-01T03:21:19.000Z",
"updated_at": "2022-07-01T03:21:19.000Z"
},
{
"id": 146,
"name": "npm",
"type": "function",
"content": {
"type": "JSFunction",
"value": "''"
},
"app": 918,
"category": "utils",
"created_at": "2022-08-29T06:54:02.000Z",
"updated_at": "2023-01-05T01:00:52.000Z"
},
{
"id": 102,
"name": "Pager",
"type": "npm",
"content": {
"package": "@opentiny/vue",
"version": "",
"exportName": "Pager",
"subName": "",
"destructuring": true,
"main": ""
},
"app": 918,
"category": "utils",
"created_at": "2022-06-28T08:17:38.000Z",
"updated_at": "2023-03-21T12:13:04.000Z"
},
{
"id": 106,
"name": "test",
"type": "function",
"content": {
"type": "JSFunction",
"value": "function util() {\r\n console.log(3211)\r\n}"
},
"app": 918,
"category": "utils",
"created_at": "2022-07-06T10:21:02.000Z",
"updated_at": "2023-03-21T12:12:49.000Z"
},
{
"id": 97,
"name": "util",
"type": "function",
"content": {
"type": "JSFunction",
"value": "function util () {\r\n console.log(321)\r\n}"
},
"app": 918,
"category": "utils",
"created_at": "2022-06-23T11:13:07.000Z",
"updated_at": "2023-04-06T02:31:44.000Z"
}
],
"locale": "zh-cn"
}

View File

@ -0,0 +1,33 @@
{
"data": {
"locales": [
{
"lang": "en_US",
"label": "美式英文"
},
{
"lang": "zh_CN",
"label": "简体中文"
}
],
"messages": {
"en_US": {
"lowcode.c257d5e8": "search",
"lowcode.61c8ac8c": "testi18n",
"lowcode.f53187a0": "test",
"lowcode.97ad00dd": "createMaterial",
"common.index.fullName": "zhangsan",
"other.utileName": "getName"
},
"zh_CN": {
"lowcode.c257d5e8": "查询",
"lowcode.61c8ac8c": "地方",
"lowcode.f53187a0": "测试",
"lowcode.97ad00dd": "创建物料资产包",
"common.index.fullName": "张三",
"other.utileName": "获取名称"
}
}
},
"locale": "zh-cn"
}

View File

@ -0,0 +1 @@
{ "data": [], "locale": "zh-cn" }

View File

@ -0,0 +1,671 @@
{
"data": [
{
"id": 132,
"name": "getAllComponent",
"data": {
"data": [],
"type": "array"
},
"tpl": null,
"app": "918",
"desc": null,
"created_at": "2022-06-28T06:26:26.000Z",
"updated_at": "2022-06-28T07:02:30.000Z"
},
{
"id": 133,
"name": "getAllList",
"data": {
"columns": [
{
"name": "test",
"title": "测试",
"field": "test",
"type": "string",
"format": {}
},
{
"name": "test1",
"title": "测试1",
"field": "test1",
"type": "string",
"format": {}
}
],
"type": "array",
"data": [
{
"test": "test1",
"test1": "test1",
"_id": "341efc48"
},
{
"test": "test2",
"test1": "test1",
"_id": "b86b516c"
},
{
"test": "test3",
"test1": "test1",
"_id": "f680cd78"
}
],
"options": {
"uri": "",
"method": "GET"
},
"dataHandler": {
"type": "JSFunction",
"value": "function dataHandler(data) { \n return data \n}"
},
"willFetch": {
"type": "JSFunction",
"value": "function willFetch(option) {\n return option \n}"
},
"shouldFetch": {
"type": "JSFunction",
"value": "function shouldFetch(option) {\n return true \n}"
},
"errorHandler": {
"type": "JSFunction",
"value": "function errorHandler(err) {}"
}
},
"tpl": null,
"app": "918",
"desc": null,
"created_at": "2022-06-28T07:32:16.000Z",
"updated_at": "2023-01-19T03:29:11.000Z"
},
{
"id": 135,
"name": "getAllMaterialList",
"data": {
"columns": [
{
"name": "id",
"title": "id",
"field": "id",
"type": "string",
"format": {}
},
{
"name": "name",
"title": "name",
"field": "name",
"type": "string",
"format": {}
},
{
"name": "framework",
"title": "framework",
"field": "framework",
"type": "string",
"format": {
"required": true
}
},
{
"name": "components",
"title": "components",
"field": "components",
"type": "string",
"format": {}
},
{
"name": "content",
"title": "content",
"field": "content",
"type": "string",
"format": {}
},
{
"name": "url",
"title": "url",
"field": "url",
"type": "string",
"format": {}
},
{
"name": "published_at",
"title": "published_at",
"field": "published_at",
"type": "string",
"format": {}
},
{
"name": "created_at",
"title": "created_at",
"field": "created_at",
"type": "string",
"format": {}
},
{
"name": "updated_at",
"title": "updated_at",
"field": "updated_at",
"type": "string",
"format": {}
},
{
"name": "published",
"title": "published",
"field": "published",
"type": "string",
"format": {}
},
{
"name": "last_build_info",
"title": "last_build_info",
"field": "last_build_info",
"type": "string",
"format": {}
},
{
"name": "tenant",
"title": "tenant",
"field": "tenant",
"type": "string",
"format": {}
},
{
"name": "version",
"title": "version",
"field": "version",
"type": "string",
"format": {}
},
{
"name": "description",
"title": "description",
"field": "description",
"type": "string",
"format": {}
}
],
"type": "array",
"data": [
{
"id": "f37123ec",
"url": "",
"name": "ng-material",
"tenant": "",
"content": "",
"version": "1.0.0",
"framework": "Angular",
"published": "",
"components": "",
"created_at": "2021-11-02T11:32:22.000Z",
"updated_at": "2021-11-02T11:32:22.000Z",
"description": "angular组件库物料",
"published_at": "2021-11-02T11:32:22.000Z",
"last_build_info": "",
"_id": "2a23e653"
},
{
"id": "f37123ec",
"url": "",
"name": "ng-material",
"tenant": "",
"content": "",
"version": "1.0.0",
"framework": "Angular",
"published": "",
"components": "",
"created_at": "2021-11-02T11:32:22.000Z",
"updated_at": "2021-11-02T11:32:22.000Z",
"description": "angular组件库物料",
"published_at": "2021-11-02T11:32:22.000Z",
"last_build_info": "",
"_id": "06b253be"
},
{
"id": "f37123ec",
"url": "",
"name": "ng-material",
"tenant": "",
"content": "",
"version": "1.0.0",
"framework": "Angular",
"published": "",
"components": "",
"created_at": "2021-11-02T11:32:22.000Z",
"updated_at": "2021-11-02T11:32:22.000Z",
"description": "angular组件库物料",
"published_at": "2021-11-02T11:32:22.000Z",
"last_build_info": "",
"_id": "c55a41ed"
},
{
"id": "f37123ec",
"url": "",
"name": "ng-material",
"tenant": "",
"content": "",
"version": "1.0.0",
"framework": "Angular",
"published": "",
"components": "",
"created_at": "2021-11-02T11:32:22.000Z",
"updated_at": "2021-11-02T11:32:22.000Z",
"description": "angular组件库物料",
"published_at": "2021-11-02T11:32:22.000Z",
"last_build_info": "",
"_id": "f37123ec"
},
{
"id": "7a63c1a2",
"url": "",
"name": "tiny-vue",
"tenant": "",
"content": "Tiny Vue物料",
"version": "1.0.0",
"framework": "Vue",
"published": "",
"components": "",
"created_at": "",
"updated_at": "",
"description": "Tiny Vue物料",
"published_at": "",
"last_build_info": "",
"_id": "7a63c1a2"
}
],
"options": {
"uri": "",
"method": "GET"
},
"willFetch": {
"type": "JSFunction",
"value": "function willFetch(option) {\n return option \n}"
},
"dataHandler": {
"type": "JSFunction",
"value": "function dataHandler(data) { \n return data \n}"
},
"shouldFetch": {
"type": "JSFunction",
"value": "function shouldFetch(option) {\n return true \n}"
},
"errorHandler": {
"type": "JSFunction",
"value": "function errorHandler(err) {}"
}
},
"tpl": null,
"app": "918",
"desc": null,
"created_at": "2022-06-29T00:57:50.000Z",
"updated_at": "2023-05-15T02:37:12.000Z"
},
{
"id": 139,
"name": "treedata",
"data": {
"data": [
{
"label": "level111",
"value": "111",
"id": "f6609643",
"pid": "",
"_RID": "row_4"
},
{
"label": "level1-son",
"value": "111-1",
"id": "af1f937f",
"pid": "f6609643",
"_RID": "row_5"
},
{
"label": "level222",
"value": "222",
"id": "28e3709c",
"pid": "",
"_RID": "row_6"
},
{
"label": "level2-son",
"value": "222-1",
"id": "6b571bef",
"pid": "28e3709c",
"_RID": "row_5"
},
{
"id": "6317c2cc",
"pid": "fdfa",
"label": "fsdfaa",
"value": "fsadf",
"_RID": "row_6"
},
{
"id": "9cce369f",
"pid": "test",
"label": "test1",
"value": "001"
}
],
"type": "tree"
},
"tpl": null,
"app": "918",
"desc": null,
"created_at": "2022-06-30T06:13:57.000Z",
"updated_at": "2022-07-29T03:14:55.000Z"
},
{
"id": 150,
"name": "componentList",
"data": {
"data": [
{
"_RID": "row_1",
"name": "表单",
"isSelected": "true",
"description": "由按钮、输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据"
},
{
"name": "按钮",
"isSelected": "false",
"description": "常用的操作按钮,提供包括默认按钮、图标按钮、图片按钮、下拉按钮等类型"
},
{
"id": "490f8a00",
"_RID": "row_3",
"name": "表单项",
"framework": "",
"materials": "",
"description": "Form 组件下的 FormItem 配置"
},
{
"id": "c259b8b3",
"_RID": "row_4",
"name": "开关",
"framework": "",
"materials": "",
"description": "关闭或打开"
},
{
"id": "083ed9c7",
"_RID": "row_5",
"name": "互斥按钮组",
"framework": "",
"materials": "",
"description": "以按钮组的方式出现,常用于多项类似操作"
},
{
"id": "09136cea",
"_RID": "row_6",
"name": "提示框",
"framework": "",
"materials": "",
"description": "Popover可通过对一个触发源操作触发弹出框,支持自定义弹出内容,延迟触发和渐变动画"
},
{
"id": "a63b57d5",
"_RID": "row_7",
"name": "文字提示框",
"framework": "",
"materials": "",
"description": "动态显示提示信息,一般通过鼠标事件进行响应;提供 warning、error、info、success 四种类型显示不同类别的信"
},
{
"id": "a0f6e8a3",
"_RID": "row_8",
"name": "树",
"framework": "",
"materials": "",
"description": "可进行展示有父子层级的数据,支持选择,异步加载等功能。但不推荐用它来展示菜单,展示菜单推荐使用树菜单"
},
{
"id": "d1aa18fc",
"_RID": "row_9",
"name": "分页",
"framework": "",
"materials": "",
"description": "当数据量过多时,使用分页分解数据,常用于 Grid 和 Repeater 组件"
},
{
"id": "ca49cc52",
"_RID": "row_10",
"name": "表格",
"framework": "",
"materials": "",
"description": "提供了非常强大数据表格功能,可以展示数据列表,可以对数据列表进行选择、编辑等"
},
{
"id": "4e20ecc9",
"name": "搜索框",
"framework": "",
"materials": "",
"description": "指定条件对象进行搜索数据"
},
{
"id": "6b093ee5",
"name": "折叠面板",
"framework": "",
"materials": "",
"description": "内容区可指定动态页面或自定义 html 等,支持展开收起操作"
},
{
"id": "0a09abc0",
"name": "对话框",
"framework": "",
"materials": "",
"description": "模态对话框,在浮层中显示,引导用户进行相关操作"
},
{
"id": "f814b901",
"name": "标签页签项",
"framework": "",
"materials": "",
"description": "tab页签"
},
{
"id": "c5ae797c",
"name": "单选",
"framework": "",
"materials": "",
"description": "用于配置不同场景的选项,在一组备选项中进行单选"
},
{
"id": "33d0c590",
"_RID": "row_13",
"name": "弹出编辑",
"framework": "",
"materials": "",
"description": "该组件只能在弹出的面板中选择数据,不能手动输入数据;弹出面板中显示为 Tree 组件或者 Grid 组件"
},
{
"id": "16711dfa",
"_RID": "row_14",
"name": "下拉框",
"framework": "",
"materials": "",
"description": "Select 选择器是一种通过点击弹出下拉列表展示数据并进行选择的 UI 组件"
},
{
"id": "a9fd190a",
"_RID": "row_15",
"name": "折叠面板项",
"framework": "",
"materials": "",
"description": "内容区可指定动态页面或自定义 html 等,支持展开收起操作"
},
{
"id": "a7dfa9ec",
"_RID": "row_16",
"name": "复选框",
"framework": "",
"materials": "",
"description": "用于配置不同场景的选项,提供用户可在一组选项中进行多选"
},
{
"id": "d4bb8330",
"name": "输入框",
"framework": "",
"materials": "",
"description": "通过鼠标或键盘输入字符"
},
{
"id": "ced3dc83",
"name": "时间线",
"framework": "",
"materials": "",
"description": "时间线"
}
],
"type": "array",
"columns": [
{
"name": "name",
"type": "string",
"field": "name",
"title": "name",
"format": {
"max": 0,
"min": 0,
"dateTime": false,
"required": false,
"stringType": ""
}
},
{
"name": "description",
"type": "string",
"field": "description",
"title": "description",
"format": {
"max": 0,
"min": 0,
"dateTime": false,
"required": false,
"stringType": ""
}
},
{
"name": "isSelected",
"type": "string",
"field": "isSelected",
"title": "isSelected",
"format": {
"max": 0,
"min": 0,
"dateTime": false,
"required": false,
"stringType": ""
}
}
],
"options": {
"uri": "http://localhost:9090/assets/json/bundle.json",
"method": "GET"
},
"willFetch": {
"type": "JSFunction",
"value": "function willFetch(option) {\n return option \n}"
},
"dataHandler": {
"type": "JSFunction",
"value": "function dataHandler(data) { \n return data \n}"
},
"shouldFetch": {
"type": "JSFunction",
"value": "function shouldFetch(option) {\n return true \n}"
},
"errorHandler": {
"type": "JSFunction",
"value": "function errorHandler(err) {}"
}
},
"tpl": null,
"app": "918",
"desc": null,
"created_at": "2022-07-04T02:20:07.000Z",
"updated_at": "2022-07-04T06:25:29.000Z"
},
{
"id": 151,
"name": "selectedComponents",
"data": {
"columns": [
{
"name": "name",
"title": "name",
"field": "name",
"type": "string",
"format": {
"required": false,
"stringType": "",
"min": 0,
"max": 0,
"dateTime": false
}
},
{
"name": "description",
"title": "description",
"field": "description",
"type": "string",
"format": {
"required": false,
"stringType": "",
"min": 0,
"max": 0,
"dateTime": false
}
},
{
"name": "isSelected",
"title": "isSelected",
"field": "isSelected",
"type": "string",
"format": {
"required": false,
"stringType": "",
"min": 0,
"max": 0,
"dateTime": false
}
}
],
"type": "array",
"data": [
{
"name": "标签页",
"description": "分隔内容上有关联但属于不同类别的数据集合",
"isSelected": "true",
"_RID": "row_2"
},
{
"name": "布局列",
"description": "列配置信息",
"isSelected": "true",
"id": "76a7080a",
"_RID": "row_4"
},
{
"name": "日期选择器",
"description": "用于设置/选择日期,包括年月/年月日/年月日时分/年月日时分秒日期格式",
"isSelected": "true",
"id": "76b20d73",
"_RID": "row_1"
},
{
"name": "走马灯",
"description": "常用于一组图片或卡片轮播,当内容空间不足时,可以用走马灯的形式进行收纳,进行轮播展现",
"isSelected": "true",
"id": "4c884c3d"
}
]
},
"tpl": null,
"app": "918",
"desc": null,
"created_at": "2022-07-04T03:04:05.000Z",
"updated_at": "2022-07-04T03:43:40.000Z"
}
],
"locale": "zh-cn"
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,503 @@
{
"data": [
{
"id": 81,
"name": "test",
"app": {
"id": 918,
"name": "portal-app",
"app_website": null,
"platform": 897,
"obs_url": "",
"created_at": "2022-06-08T07:19:01.000Z",
"updated_at": "2023-08-23T02:22:28.000Z",
"state": null,
"published": false,
"createdBy": 86,
"tenant": 1,
"home_page": "1761",
"css": null,
"config": {},
"git_group": "",
"project_name": "",
"constants": null,
"data_handler": {
"type": "JSFunction",
"value": "function dataHanlder(res){\n return res;\n}"
},
"description": "demo应用",
"latest": 22,
"platform_history": null,
"editor_url": "http://localhost:9090/platform-center/entry/portal-platform?type=app&id=918",
"branch": "develop",
"visit_url": null,
"is_demo": null,
"image_url": "http://localhost:9090/assets/images/27f7f9d26edd98f6bb1ed8d594d408d9_100x100.jpg",
"is_default": true,
"template_type": null,
"set_template_time": null,
"set_template_by": null,
"framework": "Vue",
"global_state": [
{
"id": "test1",
"state": {
"testa": 1
},
"getters": {},
"actions": {}
},
{
"id": "test2",
"state": {
"name1": "xxx1"
},
"getters": {
"count": {
"type": "JSFunction",
"value": "function count() {}"
}
},
"actions": {
"actions": {
"type": "JSFunction",
"value": "function actions() {}"
}
}
},
{
"id": "test3",
"state": {
"name1": "xxx"
},
"getters": {
"count": {
"type": "JSFunction",
"value": "function count() {}"
}
},
"actions": {
"actions": {
"type": "JSFunction",
"value": "function actions() {}"
}
}
},
{
"id": "test4",
"state": {
"region": "",
"scenario": "all",
"productId": "",
"planId": "",
"addEvs": false,
"addHss": false,
"addCbr": false,
"period": {
"value": 1,
"unit": "month"
},
"amount": 1
},
"getters": {},
"actions": {}
}
],
"default_lang": null,
"extend_config": {
"business": {
"serviceName": "",
"endpointName": "cce",
"endpointId": "ee",
"serviceId": "ee",
"router": "ee"
},
"env": {
"alpha": {
"regions": [
{
"name": "",
"baseUrl": "",
"isDefault": false
}
],
"isDefault": true
}
},
"type": "console"
},
"assets_url": "",
"data_hash": "d15fe133765a70ee503c9643a329f0db",
"can_associate": true,
"data_source_global": {
"dataHandler": {
"type": "JSFunction",
"value": "function dataHanlder(res){\n return res;\n}"
}
}
},
"desc": null,
"createdBy": {
"id": 86,
"username": "开发者",
"email": "developer@lowcode.com",
"resetPasswordToken": "developer",
"blocked": null,
"created_at": "2022-05-27T16:50:44.000Z",
"updated_at": "2022-05-27T16:50:44.000Z",
"block": null,
"is_admin": true,
"is_public": null
},
"updatedBy": {
"id": 86,
"username": "开发者",
"email": "developer@lowcode.com",
"resetPasswordToken": "developer",
"blocked": null,
"created_at": "2022-05-27T16:50:44.000Z",
"updated_at": "2022-05-27T16:50:44.000Z",
"block": null,
"is_admin": true,
"is_public": null
},
"created_at": "2023-06-12T00:49:54.000Z",
"updated_at": "2023-06-12T00:49:54.000Z",
"category_id": "test",
"blocks": []
},
{
"id": 82,
"name": "test_mChange",
"app": {
"id": 918,
"name": "portal-app",
"app_website": null,
"platform": 897,
"obs_url": "",
"created_at": "2022-06-08T07:19:01.000Z",
"updated_at": "2023-08-23T02:22:28.000Z",
"state": null,
"published": false,
"createdBy": 86,
"tenant": 1,
"home_page": "1761",
"css": null,
"config": {},
"git_group": "",
"project_name": "",
"constants": null,
"data_handler": {
"type": "JSFunction",
"value": "function dataHanlder(res){\n return res;\n}"
},
"description": "demo应用",
"latest": 22,
"platform_history": null,
"editor_url": "http://localhost:9090/platform-center/entry/portal-platform?type=app&id=918",
"branch": "develop",
"visit_url": null,
"is_demo": null,
"image_url": "http://localhost:9090/assets/images/27f7f9d26edd98f6bb1ed8d594d408d9_100x100.jpg",
"is_default": true,
"template_type": null,
"set_template_time": null,
"set_template_by": null,
"framework": "Vue",
"global_state": [
{
"id": "test1",
"state": {
"testa": 1
},
"getters": {},
"actions": {}
},
{
"id": "test2",
"state": {
"name1": "xxx1"
},
"getters": {
"count": {
"type": "JSFunction",
"value": "function count() {}"
}
},
"actions": {
"actions": {
"type": "JSFunction",
"value": "function actions() {}"
}
}
},
{
"id": "test3",
"state": {
"name1": "xxx"
},
"getters": {
"count": {
"type": "JSFunction",
"value": "function count() {}"
}
},
"actions": {
"actions": {
"type": "JSFunction",
"value": "function actions() {}"
}
}
},
{
"id": "test4",
"state": {
"region": "",
"scenario": "all",
"productId": "",
"planId": "",
"addEvs": false,
"addHss": false,
"addCbr": false,
"period": {
"value": 1,
"unit": "month"
},
"amount": 1
},
"getters": {},
"actions": {}
}
],
"default_lang": null,
"extend_config": {
"business": {
"serviceName": "",
"endpointName": "cce",
"endpointId": "ee",
"serviceId": "ee",
"router": "ee"
},
"env": {
"alpha": {
"regions": [
{
"name": "",
"baseUrl": "",
"isDefault": false
}
],
"isDefault": true
}
},
"type": "console"
},
"assets_url": "",
"data_hash": "d15fe133765a70ee503c9643a329f0db",
"can_associate": true,
"data_source_global": {
"dataHandler": {
"type": "JSFunction",
"value": "function dataHanlder(res){\n return res;\n}"
}
}
},
"desc": null,
"createdBy": {
"id": 86,
"username": "开发者",
"email": "developer@lowcode.com",
"resetPasswordToken": "developer",
"blocked": null,
"created_at": "2022-05-27T16:50:44.000Z",
"updated_at": "2022-05-27T16:50:44.000Z",
"block": null,
"is_admin": true,
"is_public": null
},
"updatedBy": {
"id": 86,
"username": "开发者",
"email": "developer@lowcode.com",
"resetPasswordToken": "developer",
"blocked": null,
"created_at": "2022-05-27T16:50:44.000Z",
"updated_at": "2022-05-27T16:50:44.000Z",
"block": null,
"is_admin": true,
"is_public": null
},
"created_at": "2023-06-12T00:50:54.000Z",
"updated_at": "2023-06-12T00:50:54.000Z",
"category_id": "test_mChange",
"blocks": []
},
{
"id": 19,
"name": "test1",
"app": {
"id": 918,
"name": "portal-app",
"app_website": null,
"platform": 897,
"obs_url": "",
"created_at": "2022-06-08T07:19:01.000Z",
"updated_at": "2023-08-23T02:22:28.000Z",
"state": null,
"published": false,
"createdBy": 86,
"tenant": 1,
"home_page": "1761",
"css": null,
"config": {},
"git_group": "",
"project_name": "",
"constants": null,
"data_handler": {
"type": "JSFunction",
"value": "function dataHanlder(res){\n return res;\n}"
},
"description": "demo应用",
"latest": 22,
"platform_history": null,
"editor_url": "http://localhost:9090/platform-center/entry/portal-platform?type=app&id=918",
"branch": "develop",
"visit_url": null,
"is_demo": null,
"image_url": "http://localhost:9090/assets/images/27f7f9d26edd98f6bb1ed8d594d408d9_100x100.jpg",
"is_default": true,
"template_type": null,
"set_template_time": null,
"set_template_by": null,
"framework": "Vue",
"global_state": [
{
"id": "test1",
"state": {
"testa": 1
},
"getters": {},
"actions": {}
},
{
"id": "test2",
"state": {
"name1": "xxx1"
},
"getters": {
"count": {
"type": "JSFunction",
"value": "function count() {}"
}
},
"actions": {
"actions": {
"type": "JSFunction",
"value": "function actions() {}"
}
}
},
{
"id": "test3",
"state": {
"name1": "xxx"
},
"getters": {
"count": {
"type": "JSFunction",
"value": "function count() {}"
}
},
"actions": {
"actions": {
"type": "JSFunction",
"value": "function actions() {}"
}
}
},
{
"id": "test4",
"state": {
"region": "",
"scenario": "all",
"productId": "",
"planId": "",
"addEvs": false,
"addHss": false,
"addCbr": false,
"period": {
"value": 1,
"unit": "month"
},
"amount": 1
},
"getters": {},
"actions": {}
}
],
"default_lang": null,
"extend_config": {
"business": {
"serviceName": "",
"endpointName": "cce",
"endpointId": "ee",
"serviceId": "ee",
"router": "ee"
},
"env": {
"alpha": {
"regions": [
{
"name": "",
"baseUrl": "",
"isDefault": false
}
],
"isDefault": true
}
},
"type": "console"
},
"assets_url": "",
"data_hash": "d15fe133765a70ee503c9643a329f0db",
"can_associate": true,
"data_source_global": {
"dataHandler": {
"type": "JSFunction",
"value": "function dataHanlder(res){\n return res;\n}"
}
}
},
"desc": null,
"createdBy": {
"id": 86,
"username": "开发者",
"email": "developer@lowcode.com",
"resetPasswordToken": "developer",
"blocked": null,
"created_at": "2022-05-27T16:50:44.000Z",
"updated_at": "2022-05-27T16:50:44.000Z",
"block": null,
"is_admin": true,
"is_public": null
},
"updatedBy": {
"id": 86,
"username": "开发者",
"email": "developer@lowcode.com",
"resetPasswordToken": "developer",
"blocked": null,
"created_at": "2022-05-27T16:50:44.000Z",
"updated_at": "2022-05-27T16:50:44.000Z",
"block": null,
"is_admin": true,
"is_public": null
},
"created_at": "2023-03-22T07:26:04.000Z",
"updated_at": "2023-06-02T08:45:34.000Z",
"category_id": "test_mChange01",
"blocks": []
}
],
"locale": "zh-cn"
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,148 @@
{
"data": [
{
"id": 37,
"createdBy": {
"id": 86,
"username": "开发者",
"email": "developer@lowcode.com",
"resetPasswordToken": "developer",
"blocked": null,
"created_at": "2022-05-27T16:50:44.000Z",
"updated_at": "2022-05-27T16:50:44.000Z",
"block": null,
"is_admin": true,
"is_public": null
},
"updatedBy": {
"id": 86,
"username": "开发者",
"email": "developer@lowcode.com",
"resetPasswordToken": "developer",
"blocked": null,
"created_at": "2022-05-27T16:50:44.000Z",
"updated_at": "2022-05-27T16:50:44.000Z",
"block": null,
"is_admin": true,
"is_public": null
},
"created_at": "2023-08-17T02:40:06.000Z",
"updated_at": "2023-08-17T02:40:21.000Z",
"category": "appDev",
"name": "ai生成简单页面教程",
"desc": "",
"poster": "http://localhost:9090/assets/images/0055f57e0a38d45ced54e1b2b566cb29_308x180.jpg",
"type": "advanced",
"tags": "",
"variety": "solution",
"videos": [],
"progress": 0
},
{
"id": 34,
"createdBy": {
"id": 108,
"username": "张三",
"email": "xyz@email.com",
"resetPasswordToken": "工号xxxxxx",
"blocked": null,
"created_at": "2022-06-22T08:20:55.000Z",
"updated_at": "2022-12-08T07:29:41.000Z",
"block": null,
"is_admin": false,
"is_public": null
},
"updatedBy": {
"id": 108,
"username": "张三",
"email": "xyz@email.com",
"resetPasswordToken": "工号xxxxxx",
"blocked": null,
"created_at": "2022-06-22T08:20:55.000Z",
"updated_at": "2022-12-08T07:29:41.000Z",
"block": null,
"is_admin": false,
"is_public": null
},
"created_at": "2022-08-27T07:29:49.000Z",
"updated_at": "2022-08-27T07:29:49.000Z",
"category": "appDev",
"name": "如何加入组织",
"desc": "讲解如何加入已有组织,如何创建自己的组织",
"poster": "http://localhost:9090/assets/images/627366463067fa2f1a59d7db4ac55885_308x100.jpg",
"type": "introductory",
"tags": ["入门", "最新"],
"variety": "manual",
"videos": [
{
"id": 72,
"courseId": 34,
"title": "申请加入组织",
"video": "http://localhost:9090/assets/videos/tiny-engine.mp4",
"docs": "TinyEngine简介",
"created_at": "2022-08-27T07:29:49.000Z",
"updated_at": "2022-08-27T07:29:49.000Z"
},
{
"id": 73,
"courseId": 34,
"title": "创建平台",
"video": "http://localhost:9090/assets/videos/tiny-engine.mp4",
"docs": "fdsa",
"created_at": "2022-08-27T07:29:49.000Z",
"updated_at": "2022-08-27T07:29:49.000Z"
}
],
"progress": 0
},
{
"id": 28,
"createdBy": {
"id": 169,
"username": "张三",
"email": "xyz@email.com",
"resetPasswordToken": "工号xxxxxx",
"blocked": null,
"created_at": "2022-07-04T07:25:53.000Z",
"updated_at": "2022-09-27T11:48:34.000Z",
"block": null,
"is_admin": true,
"is_public": true
},
"updatedBy": {
"id": 169,
"username": "张三",
"email": "xyz@email.com",
"resetPasswordToken": "工号xxxxxx",
"blocked": null,
"created_at": "2022-07-04T07:25:53.000Z",
"updated_at": "2022-09-27T11:48:34.000Z",
"block": null,
"is_admin": true,
"is_public": true
},
"created_at": "2022-08-10T08:38:06.000Z",
"updated_at": "2022-08-11T03:44:28.000Z",
"category": "appDev",
"name": "实战课程",
"desc": "实战课程",
"poster": "http://localhost:9090/assets/images/777aad0c570f653f0a95b48b898c7b4b_308x180.jpg",
"type": "practical",
"tags": "",
"variety": "manual",
"videos": [
{
"id": 66,
"courseId": 28,
"title": "从零搭建一个页面",
"video": "http://localhost:9090/assets/videos/in-action.mp4",
"docs": "",
"created_at": "2022-08-10T08:38:06.000Z",
"updated_at": "2022-08-10T08:38:06.000Z"
}
],
"progress": 0
}
],
"locale": "zh-cn"
}

View File

@ -0,0 +1,57 @@
{
"data": {
"id": 86,
"username": "开发者",
"email": "developer@lowcode.com",
"provider": null,
"password": null,
"resetPasswordToken": "developer",
"confirmationToken": "uuid~dfafasdfasdfa",
"confirmed": true,
"blocked": null,
"role": null,
"created_by": null,
"updated_by": null,
"created_at": "2021-11-11T13:52:21.000Z",
"updated_at": "2022-11-01T01:39:30.000Z",
"block": null,
"is_admin": true,
"is_public": null,
"tenant": {
"id": "1"
},
"auths": [
{
"id": 265,
"unit": {
"type": "tenant",
"id": 1,
"name": "public"
},
"auth_type": null,
"expired_time": null,
"role": {
"name": "Tinybuilder_Tenant_Admin",
"id": 6,
"description": "组织管理员"
}
}
],
"tenants": [
{
"id": 1,
"tenant_id": "public",
"name_cn": "公共租户",
"name_en": "Public Tenant",
"description": "Default tenant for new user to explore.",
"created_by": null,
"updated_by": null,
"created_at": "2021-12-28T11:39:10.000Z",
"updated_at": "2023-02-09T08:23:00.000Z",
"createdBy": null,
"updatedBy": 86
}
]
},
"locale": "zh-cn"
}

View File

@ -0,0 +1 @@
{ "data": [], "locale": "zh-cn" }

View File

@ -0,0 +1 @@
{ "data": [], "locale": "zh-cn" }

View File

@ -0,0 +1 @@
{ "data": [], "locale": "zh-cn" }

View File

@ -0,0 +1 @@
{ "data": [], "locale": "zh-cn" }

View File

@ -0,0 +1 @@
{ "data": [], "locale": "zh-cn" }

View File

@ -0,0 +1 @@
{ "data": [], "locale": "zh-cn" }

View File

@ -0,0 +1 @@
{ "data": [], "locale": "zh-cn" }

View File

@ -0,0 +1,69 @@
{
"data": {
"id": 133,
"name": "getAllList",
"data": {
"columns": [
{
"name": "test",
"title": "测试",
"field": "test",
"type": "string",
"format": {}
},
{
"name": "test1",
"title": "测试1",
"field": "test1",
"type": "string",
"format": {}
}
],
"type": "array",
"data": [
{
"test": "test1",
"test1": "test1",
"_id": "341efc48"
},
{
"test": "test2",
"test1": "test1",
"_id": "b86b516c"
},
{
"test": "test3",
"test1": "test1",
"_id": "f680cd78"
}
],
"options": {
"uri": "/app-center/api/sources/list/918",
"isSync": true,
"method": "GET"
},
"dataHandler": {
"type": "JSFunction",
"value": "function dataHandler(data) { \n return data \n}"
},
"willFetch": {
"type": "JSFunction",
"value": "function willFetch(option) {\n return option \n}"
},
"shouldFetch": {
"type": "JSFunction",
"value": "function shouldFetch(option) {\n return true \n}"
},
"errorHandler": {
"type": "JSFunction",
"value": "function errorHandler(err) {}"
}
},
"tpl": null,
"app": "918",
"desc": null,
"created_at": "2022-06-28T07:32:16.000Z",
"updated_at": "2023-01-19T03:29:11.000Z"
},
"locale": "zh-cn"
}

View File

@ -0,0 +1,24 @@
/**
* 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 = function () {
return function (ctx, next) {
switch (ctx.status) {
case 404:
ctx.body = '没有找到内容 - 404'
break
default:
break
}
return next()
}
}

View File

@ -0,0 +1,112 @@
/**
* 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 KoaRouter from 'koa-router'
import * as glob from 'glob'
import path from 'path'
import fs from 'fs-extra'
import Schema2CodeServcice from '../services/schema2code'
import PageService from '../services/pages'
import AppService from '../services/app'
import BlockService from '../services/block'
import SourceService from '../services/source'
const router = new KoaRouter()
const schema2codeService = new Schema2CodeServcice()
export const pageService = new PageService()
export const appService = new AppService()
export const blockService = new BlockService()
export const sourceService = new SourceService()
const getJsonPathData = (jpath, method = 'get') => {
const usefulPath = jpath.split(`${method}${path.sep}`)[1]
const apipath = usefulPath.split(path.sep)
const lastSegment = apipath[apipath.length - 1]
const lastdirname = lastSegment.split('.')[0]
apipath[apipath.length - 1] = lastdirname
const [center, version, ...routes] = apipath
let api = ''
if (version === 'v1') {
api = `/${center}/${version}/api/${routes.join('/')}`
} else {
api = `/${center}/api/${version}/${routes.join('/')}`
}
const data = fs.readJSONSync(path.resolve(__dirname, path.relative(__dirname, jpath)))
return {
api,
data
}
}
const mockPath = path.resolve(__dirname, '../mock')
// 注册路由
glob.globSync(`${mockPath}/get/**/*.json`).forEach((jpath) => {
const { api, data } = getJsonPathData(jpath)
router.get(api, (ctx, next) => {
ctx.body = data
})
})
glob.globSync(`${mockPath}/post/**/*.json`).forEach((jpath) => {
const { api, data } = getJsonPathData(jpath, 'post')
router.post(api, (ctx, next) => {
ctx.body = data
})
})
router.get('/app-center/api/apps/canvas/lock', async (ctx) => {
ctx.body = await appService.lock(ctx.request.query)
})
router.post('/app-center/api/schema2code', (ctx) => {
const { pageInfo } = ctx.request.body
ctx.body = schema2codeService.schema2code(pageInfo)
})
router.get('/app-center/api/preview/metadata', (ctx) => {
ctx.body = appService.getAppPreviewMetaData()
})
router.post('/app-center/api/pages/create', async (ctx) => {
ctx.body = await pageService.create(ctx.request.body)
})
router.post('/app-center/api/pages/update/:id', async (ctx) => {
const { id } = ctx.params
const { body } = ctx.request
ctx.body = await pageService.update(id, body)
})
router.get('/app-center/api/pages/list/:appId', async (ctx) => {
const { appId } = ctx.params
ctx.body = await pageService.list(appId)
})
router.get('/app-center/api/pages/detail/:id', async (ctx) => {
const { id } = ctx.params
ctx.body = await pageService.detail(id)
})
router.get('/app-center/api/pages/delete/:id', async (ctx) => {
const { id } = ctx.params
ctx.body = await pageService.delete(id)
})
router.get('/material-center/api/block', (ctx)=> {
ctx.body = blockService.find(ctx.request.query)
})
router.get('/app-center/api/sources/detail/:id', async (ctx) => {
const { id } = ctx.params
ctx.body = await sourceService.detail(id)
})
export default router

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,73 @@
/**
* 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 { pageService } from '../routes/main-routes'
import { getResponseData } from '../tool/Common'
export default class AppService {
async lock(query) {
const { id, state } = query
const occupier = state === 'occupy' ? pageService.userInfo : null
await pageService.update(id, { occupier })
return getResponseData({
operate: 'success',
occupier
})
}
// 获取应用预览数据
getAppPreviewMetaData() {
const appMetaData = require('./appinfo.json')
const { i18n: i18nEntries, source = [], extension = [], app } = appMetaData
// 拼装数据源
const dataSource = {
list: source,
dataHandler: app['data_handler']
}
// 拼装工具类
const utils = []
extension.forEach((item) => {
const { name, type, content, category } = item
const data = { name, type, content }
if (category === 'utils') {
utils.push(data)
}
})
// 拼装国际化词条
const entriesData = getResponseData(i18nEntries)
const i18n = this.formatI18nEntrites(entriesData)
return getResponseData({
dataSource,
globalState: app['global_state'],
utils,
i18n
})
}
formatI18nEntrites(entriesData) {
const entries = entriesData.data
// 中文和英文作为全局国际化语言,并没有和应用/区块建立关联关系
const defaultLang = [{ lang: 'en_US' }, { lang: 'zh_CN' }]
const res = {}
entries.forEach((entry) => {
const {
key,
lang: { lang },
content
} = entry
res[lang] = res[lang] || {}
res[lang][key] = content
})
return res
}
}

File diff suppressed because one or more lines are too long

View File

@ -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.
*
*/
import { getResponseData } from '../tool/Common'
import blocks from './blocks.json'
export default class BlockService {
find({label}) {
const blockData = blocks[label] || {}
return getResponseData(blockData)
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,178 @@
/**
* 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 { E_SchemaFormatFunc } from './utils'
import { getResponseData } from '../tool/Common'
const config = {
pageMeta: {
convert: {
page_desc: 'description',
route: 'router',
isBody: 'rootElement',
createdBy: 'creator',
created_at: 'gmt_create',
updated_at: 'gmt_modified'
},
include: [
'id',
'title',
'page_desc',
'createdBy',
'parentId',
'created_at',
'updated_at',
'isHome',
'isBody',
'group',
'route',
'occupier'
],
format: {
created_at: E_SchemaFormatFunc.ToLocalTimestamp,
updated_at: E_SchemaFormatFunc.ToLocalTimestamp,
isBody: E_SchemaFormatFunc.ToRootElement,
group: E_SchemaFormatFunc.ToGroupName,
createdBy: E_SchemaFormatFunc.ToCreatorName
}
},
pageContent: {
include: ['fileName', 'componentName', 'props', 'css', 'children', 'methods', 'state', 'lifeCycles']
},
folder: {
convert: {
name: 'folderName',
route: 'router',
created_at: 'gmt_create',
updated_at: 'gmt_modified'
},
include: ['name', 'route', 'created_at', 'updated_at', 'id', 'parentId', 'depth'],
format: {
created_at: E_SchemaFormatFunc.ToLocalTimestamp,
updated_at: E_SchemaFormatFunc.ToLocalTimestamp
}
}
}
export default class PageSchemaService {
constructor() {
this.config = config
}
assembleFields(originalData, type) {
let dataCopy = JSON.parse(JSON.stringify(originalData.data))
const conf = this.config[type]
if (conf.include || conf.exclude) {
dataCopy = this.filterFields(dataCopy, conf)
}
if (conf.format) {
dataCopy = this.formatFields(dataCopy, conf)
}
if (conf.convert) {
dataCopy = this.convertFields(dataCopy, conf)
}
return getResponseData(dataCopy)
}
// 转换数据表字段为schema中的字段命名
convertFields(data, conf) {
const convertConf = conf.convert || {}
Object.keys(convertConf).forEach((key) => {
data[convertConf[key]] = data[key]
delete data[key]
})
return data
}
// 筛选数据
filterFields(data, conf) {
const excludeConf = conf.exclude || []
const includeConf = conf.include || []
let res = {}
// include 优先级高于 exclude
if (includeConf.length) {
for (const key in data) {
if (includeConf.includes(key)) {
res[key] = data[key]
}
}
} else if (excludeConf.length) {
for (const key in data) {
if (!excludeConf.includes(key)) {
res[key] = data[key]
}
}
} else {
res = data
}
return res
}
// 格式化数据
formatFields(data, conf) {
const { format = {} } = conf
Object.keys(format).forEach((key) => {
const funcName = format[key]
const func = this[funcName]
if (func) {
data[key] = func(data[key])
}
})
return data
}
// 获取页面元数据
getSchemaMeta(pageData) {
return this.assembleFields(pageData, 'pageMeta')
}
// 提取page_schema
getSchemaBase(pageData) {
const pageMate = JSON.parse(JSON.stringify(pageData.data))
const pageContent = pageMate.page_content || {}
pageContent.fileName = pageMate.name
return this.assembleFields(
{
data: pageContent
},
'pageContent'
)
}
// 获取folder schema数据 todo
getFolderSchema(param) {
const schema = this.assembleFields(
{
data: param
},
'folder'
)
schema.data.componentName = 'Folder'
return schema
}
// 获取页面的schema
getSchema(pageInfo) {
const pageInfoData = {
data: pageInfo
}
if (!pageInfo.isPage) {
return this.getFolderSchema(pageInfo)
}
const schema = this.getSchemaBase(pageInfoData).data
// 从page_schema中获取基本字段
schema.meta = this.getSchemaMeta(pageInfoData).data
return getResponseData(schema)
}
}

View File

@ -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 path from 'path'
import DateStore from '@seald-io/nedb'
import { getResponseData } from '../tool/Common'
export default class PageService {
constructor() {
this.db = new DateStore({
filename: path.resolve(__dirname, '../database/pages.db'),
autoload: true
})
this.db.ensureIndex({
fieldName: 'route',
unique: true
})
this.userInfo = {
id: 86,
username: '开发者',
email: 'developer@lowcode.com',
resetPasswordToken: 'developer',
confirmationToken: 'dfb2c162-351f-4f44-ad5f-8998',
is_admin: true
}
this.pageModel = {
name: '',
id: '',
app: '918',
route: '',
page_content: {},
tenant: 1,
isBody: true,
parentId: '',
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
}
}
this.folderModel = {
parentId: '0',
route: 'test',
name: 'test',
app: '918',
isPage: false,
group: 'staticPages'
}
}
async create(params) {
const model = params.isPage ? this.pageModel : this.folderModel
const pageData = { ...model, ...params }
const result = await this.db.insertAsync(pageData)
const { _id } = result
await this.db.updateAsync({ _id }, { $set: { id: _id } })
result.id = result._id
return getResponseData(result)
}
async update(id, params) {
await this.db.updateAsync({ _id: id }, { $set: params })
const result = await this.db.findOneAsync({ _id: id })
return getResponseData(result)
}
async list(appId) {
const result = await this.db.findAsync({ app: appId.toString() })
return getResponseData(result)
}
async detail(pageId) {
const result = await this.db.findOneAsync({ _id: pageId })
return getResponseData(result)
}
async delete(pageId) {
const result = await this.db.findOneAsync({ _id: pageId })
await this.db.removeAsync({ _id: pageId })
return getResponseData(result)
}
}

View File

@ -0,0 +1,113 @@
/**
* 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 { pageService } from '../routes/main-routes'
import appInfo from './appinfo.json'
export default class Schema2CodeServcice {
constructor() {
this.blockHistories = appInfo.blockHistories
this.components = appInfo.materialHistory.components
}
schema2code(pageInfo, type = 'page') {
const { schema, name } = pageInfo
return this.translateSchema({
schema,
name,
type
})
}
/**
* 通过dsl 将页面/区块schema数据生成对应代码
* @param { I_TranslateSchemaParam } params
* @return {Promise<I_Response>} dsl函数返回数据
*/
translateSchema(params) {
const { schema, name, type, blockHistories = this.blockHistories, components = this.components } = params
// 页面/区块 预览只需将页面、区块路径和区块构建产物路径统一设置为 ./components 即可
const defaultMain = './components'
let componentsMap = this.getComponentSchema(components)
componentsMap = componentsMap.concat(this.getBlockSchema(blockHistories))
componentsMap.forEach((component) => {
if (component.main !== undefined) {
component.main = defaultMain
}
})
componentsMap.push({
componentName: name,
main: defaultMain
})
const { generateCode } = require('@opentiny/lowcode-dsl-vue')
let code
try {
code = generateCode({
pageInfo: { schema, name },
blocksData: [],
componentsMap
})
} catch (e) {
this.getResponseData(null, e)
}
return this.getResponseData(code)
}
getResponseData(data, error) {
const res = {
data
}
if (error) {
const err_code = error.code || ''
res.error = {
code: err_code,
message: error.message || ''
}
}
return res
}
getComponentSchema(components) {
return components.map((component) => {
const {
component: componentName,
npm: { package: packageName, exportName, version, destructuring }
} = component
return {
componentName,
package: packageName,
exportName,
destructuring,
version
}
})
}
// 将区块组装成schema数据
getBlockSchema(blockHistories) {
return blockHistories.map((blockHistory) => {
const { path, version } = blockHistory
// 每个区块历史记录必有content
const { fileName: componentName } = blockHistory.content
return {
componentName,
main: path || '',
destructuring: false,
version: version || 'N/A'
}
})
}
}

View File

@ -0,0 +1,21 @@
/**
* 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 { getResponseData } from '../tool/Common'
import sources from './sources.json'
export default class soueceService {
detail(id) {
const sourceData = sources[id] || {}
return getResponseData(sourceData)
}
}

View File

@ -0,0 +1,669 @@
{
"132": {
"id": 132,
"name": "getAllComponent",
"data": {
"data": [],
"type": "array"
},
"tpl": null,
"app": "918",
"desc": null,
"created_at": "2022-06-28T06:26:26.000Z",
"updated_at": "2022-06-28T07:02:30.000Z"
},
"133": {
"id": 133,
"name": "getAllList",
"data": {
"columns": [
{
"name": "test",
"title": "测试",
"field": "test",
"type": "string",
"format": {}
},
{
"name": "test1",
"title": "测试1",
"field": "test1",
"type": "string",
"format": {}
}
],
"type": "array",
"data": [
{
"test": "test1",
"test1": "test1",
"_id": "341efc48"
},
{
"test": "test2",
"test1": "test1",
"_id": "b86b516c"
},
{
"test": "test3",
"test1": "test1",
"_id": "f680cd78"
}
],
"options": {
"uri": "https://mock.demo.com/mock/198/material-center/api/component/list",
"method": "GET"
},
"dataHandler": {
"type": "JSFunction",
"value": "function dataHandler(data) { \n return data \n}"
},
"willFetch": {
"type": "JSFunction",
"value": "function willFetch(option) {\n return option \n}"
},
"shouldFetch": {
"type": "JSFunction",
"value": "function shouldFetch(option) {\n return true \n}"
},
"errorHandler": {
"type": "JSFunction",
"value": "function errorHandler(err) {}"
}
},
"tpl": null,
"app": "918",
"desc": null,
"created_at": "2022-06-28T07:32:16.000Z",
"updated_at": "2023-01-19T03:29:11.000Z"
},
"135": {
"id": 135,
"name": "getAllMaterialList",
"data": {
"columns": [
{
"name": "id",
"title": "id",
"field": "id",
"type": "string",
"format": {}
},
{
"name": "name",
"title": "name",
"field": "name",
"type": "string",
"format": {}
},
{
"name": "framework",
"title": "framework",
"field": "framework",
"type": "string",
"format": {
"required": true
}
},
{
"name": "components",
"title": "components",
"field": "components",
"type": "string",
"format": {}
},
{
"name": "content",
"title": "content",
"field": "content",
"type": "string",
"format": {}
},
{
"name": "url",
"title": "url",
"field": "url",
"type": "string",
"format": {}
},
{
"name": "published_at",
"title": "published_at",
"field": "published_at",
"type": "string",
"format": {}
},
{
"name": "created_at",
"title": "created_at",
"field": "created_at",
"type": "string",
"format": {}
},
{
"name": "updated_at",
"title": "updated_at",
"field": "updated_at",
"type": "string",
"format": {}
},
{
"name": "published",
"title": "published",
"field": "published",
"type": "string",
"format": {}
},
{
"name": "last_build_info",
"title": "last_build_info",
"field": "last_build_info",
"type": "string",
"format": {}
},
{
"name": "tenant",
"title": "tenant",
"field": "tenant",
"type": "string",
"format": {}
},
{
"name": "version",
"title": "version",
"field": "version",
"type": "string",
"format": {}
},
{
"name": "description",
"title": "description",
"field": "description",
"type": "string",
"format": {}
}
],
"type": "array",
"data": [
{
"id": "f37123ec",
"url": "",
"name": "ng-material",
"tenant": "",
"content": "",
"version": "1.0.0",
"framework": "Angular",
"published": "",
"components": "",
"created_at": "2021-11-02T11:32:22.000Z",
"updated_at": "2021-11-02T11:32:22.000Z",
"description": "angular组件库物料",
"published_at": "2021-11-02T11:32:22.000Z",
"last_build_info": "",
"_id": "2a23e653"
},
{
"id": "f37123ec",
"url": "",
"name": "ng-material",
"tenant": "",
"content": "",
"version": "1.0.0",
"framework": "Angular",
"published": "",
"components": "",
"created_at": "2021-11-02T11:32:22.000Z",
"updated_at": "2021-11-02T11:32:22.000Z",
"description": "angular组件库物料",
"published_at": "2021-11-02T11:32:22.000Z",
"last_build_info": "",
"_id": "06b253be"
},
{
"id": "f37123ec",
"url": "",
"name": "ng-material",
"tenant": "",
"content": "",
"version": "1.0.0",
"framework": "Angular",
"published": "",
"components": "",
"created_at": "2021-11-02T11:32:22.000Z",
"updated_at": "2021-11-02T11:32:22.000Z",
"description": "angular组件库物料",
"published_at": "2021-11-02T11:32:22.000Z",
"last_build_info": "",
"_id": "c55a41ed"
},
{
"id": "f37123ec",
"url": "",
"name": "ng-material",
"tenant": "",
"content": "",
"version": "1.0.0",
"framework": "Angular",
"published": "",
"components": "",
"created_at": "2021-11-02T11:32:22.000Z",
"updated_at": "2021-11-02T11:32:22.000Z",
"description": "angular组件库物料",
"published_at": "2021-11-02T11:32:22.000Z",
"last_build_info": "",
"_id": "f37123ec"
},
{
"id": "7a63c1a2",
"url": "",
"name": "tiny-vue",
"tenant": "",
"content": "Tiny Vue物料",
"version": "1.0.0",
"framework": "Vue",
"published": "",
"components": "",
"created_at": "",
"updated_at": "",
"description": "Tiny Vue物料",
"published_at": "",
"last_build_info": "",
"_id": "7a63c1a2"
}
],
"options": {
"uri": "https://mock.demo.com/mock/198/material-center/api/material/list",
"method": "GET"
},
"willFetch": {
"type": "JSFunction",
"value": "function willFetch(option) {\n return option \n}"
},
"dataHandler": {
"type": "JSFunction",
"value": "function dataHandler(data) { \n return data \n}"
},
"shouldFetch": {
"type": "JSFunction",
"value": "function shouldFetch(option) {\n return true \n}"
},
"errorHandler": {
"type": "JSFunction",
"value": "function errorHandler(err) {}"
}
},
"tpl": null,
"app": "918",
"desc": null,
"created_at": "2022-06-29T00:57:50.000Z",
"updated_at": "2023-05-15T02:37:12.000Z"
},
"139": {
"id": 139,
"name": "treedata",
"data": {
"data": [
{
"label": "level111",
"value": "111",
"id": "f6609643",
"pid": "",
"_RID": "row_4"
},
{
"label": "level1-son",
"value": "111-1",
"id": "af1f937f",
"pid": "f6609643",
"_RID": "row_5"
},
{
"label": "level222",
"value": "222",
"id": "28e3709c",
"pid": "",
"_RID": "row_6"
},
{
"label": "level2-son",
"value": "222-1",
"id": "6b571bef",
"pid": "28e3709c",
"_RID": "row_5"
},
{
"id": "6317c2cc",
"pid": "fdfa",
"label": "fsdfaa",
"value": "fsadf",
"_RID": "row_6"
},
{
"id": "9cce369f",
"pid": "test",
"label": "test1",
"value": "001"
}
],
"type": "tree"
},
"tpl": null,
"app": "918",
"desc": null,
"created_at": "2022-06-30T06:13:57.000Z",
"updated_at": "2022-07-29T03:14:55.000Z"
},
"150": {
"id": 150,
"name": "componentList",
"data": {
"data": [
{
"_RID": "row_1",
"name": "表单",
"isSelected": "true",
"description": "由按钮、输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据"
},
{
"name": "按钮",
"isSelected": "false",
"description": "常用的操作按钮,提供包括默认按钮、图标按钮、图片按钮、下拉按钮等类型"
},
{
"id": "490f8a00",
"_RID": "row_3",
"name": "表单项",
"framework": "",
"materials": "",
"description": "Form 组件下的 FormItem 配置"
},
{
"id": "c259b8b3",
"_RID": "row_4",
"name": "开关",
"framework": "",
"materials": "",
"description": "关闭或打开"
},
{
"id": "083ed9c7",
"_RID": "row_5",
"name": "互斥按钮组",
"framework": "",
"materials": "",
"description": "以按钮组的方式出现,常用于多项类似操作"
},
{
"id": "09136cea",
"_RID": "row_6",
"name": "提示框",
"framework": "",
"materials": "",
"description": "Popover可通过对一个触发源操作触发弹出框,支持自定义弹出内容,延迟触发和渐变动画"
},
{
"id": "a63b57d5",
"_RID": "row_7",
"name": "文字提示框",
"framework": "",
"materials": "",
"description": "动态显示提示信息,一般通过鼠标事件进行响应;提供 warning、error、info、success 四种类型显示不同类别的信"
},
{
"id": "a0f6e8a3",
"_RID": "row_8",
"name": "树",
"framework": "",
"materials": "",
"description": "可进行展示有父子层级的数据,支持选择,异步加载等功能。但不推荐用它来展示菜单,展示菜单推荐使用树菜单"
},
{
"id": "d1aa18fc",
"_RID": "row_9",
"name": "分页",
"framework": "",
"materials": "",
"description": "当数据量过多时,使用分页分解数据,常用于 Grid 和 Repeater 组件"
},
{
"id": "ca49cc52",
"_RID": "row_10",
"name": "表格",
"framework": "",
"materials": "",
"description": "提供了非常强大数据表格功能,可以展示数据列表,可以对数据列表进行选择、编辑等"
},
{
"id": "4e20ecc9",
"name": "搜索框",
"framework": "",
"materials": "",
"description": "指定条件对象进行搜索数据"
},
{
"id": "6b093ee5",
"name": "折叠面板",
"framework": "",
"materials": "",
"description": "内容区可指定动态页面或自定义 html 等,支持展开收起操作"
},
{
"id": "0a09abc0",
"name": "对话框",
"framework": "",
"materials": "",
"description": "模态对话框,在浮层中显示,引导用户进行相关操作"
},
{
"id": "f814b901",
"name": "标签页签项",
"framework": "",
"materials": "",
"description": "tab页签"
},
{
"id": "c5ae797c",
"name": "单选",
"framework": "",
"materials": "",
"description": "用于配置不同场景的选项,在一组备选项中进行单选"
},
{
"id": "33d0c590",
"_RID": "row_13",
"name": "弹出编辑",
"framework": "",
"materials": "",
"description": "该组件只能在弹出的面板中选择数据,不能手动输入数据;弹出面板中显示为 Tree 组件或者 Grid 组件"
},
{
"id": "16711dfa",
"_RID": "row_14",
"name": "下拉框",
"framework": "",
"materials": "",
"description": "Select 选择器是一种通过点击弹出下拉列表展示数据并进行选择的 UI 组件"
},
{
"id": "a9fd190a",
"_RID": "row_15",
"name": "折叠面板项",
"framework": "",
"materials": "",
"description": "内容区可指定动态页面或自定义 html 等,支持展开收起操作"
},
{
"id": "a7dfa9ec",
"_RID": "row_16",
"name": "复选框",
"framework": "",
"materials": "",
"description": "用于配置不同场景的选项,提供用户可在一组选项中进行多选"
},
{
"id": "d4bb8330",
"name": "输入框",
"framework": "",
"materials": "",
"description": "通过鼠标或键盘输入字符"
},
{
"id": "ced3dc83",
"name": "时间线",
"framework": "",
"materials": "",
"description": "时间线"
}
],
"type": "array",
"columns": [
{
"name": "name",
"type": "string",
"field": "name",
"title": "name",
"format": {
"max": 0,
"min": 0,
"dateTime": false,
"required": false,
"stringType": ""
}
},
{
"name": "description",
"type": "string",
"field": "description",
"title": "description",
"format": {
"max": 0,
"min": 0,
"dateTime": false,
"required": false,
"stringType": ""
}
},
{
"name": "isSelected",
"type": "string",
"field": "isSelected",
"title": "isSelected",
"format": {
"max": 0,
"min": 0,
"dateTime": false,
"required": false,
"stringType": ""
}
}
],
"options": {
"uri": "http://localhost:9090/assets/json/bundle.json",
"method": "GET"
},
"willFetch": {
"type": "JSFunction",
"value": "function willFetch(option) {\n return option \n}"
},
"dataHandler": {
"type": "JSFunction",
"value": "function dataHandler(data) { \n return data \n}"
},
"shouldFetch": {
"type": "JSFunction",
"value": "function shouldFetch(option) {\n return true \n}"
},
"errorHandler": {
"type": "JSFunction",
"value": "function errorHandler(err) {}"
}
},
"tpl": null,
"app": "918",
"desc": null,
"created_at": "2022-07-04T02:20:07.000Z",
"updated_at": "2022-07-04T06:25:29.000Z"
},
"151": {
"id": 151,
"name": "selectedComponents",
"data": {
"columns": [
{
"name": "name",
"title": "name",
"field": "name",
"type": "string",
"format": {
"required": false,
"stringType": "",
"min": 0,
"max": 0,
"dateTime": false
}
},
{
"name": "description",
"title": "description",
"field": "description",
"type": "string",
"format": {
"required": false,
"stringType": "",
"min": 0,
"max": 0,
"dateTime": false
}
},
{
"name": "isSelected",
"title": "isSelected",
"field": "isSelected",
"type": "string",
"format": {
"required": false,
"stringType": "",
"min": 0,
"max": 0,
"dateTime": false
}
}
],
"type": "array",
"data": [
{
"name": "标签页",
"description": "分隔内容上有关联但属于不同类别的数据集合",
"isSelected": "true",
"_RID": "row_2"
},
{
"name": "布局列",
"description": "列配置信息",
"isSelected": "true",
"id": "76a7080a",
"_RID": "row_4"
},
{
"name": "日期选择器",
"description": "用于设置/选择日期,包括年月/年月日/年月日时分/年月日时分秒日期格式",
"isSelected": "true",
"id": "76b20d73",
"_RID": "row_1"
},
{
"name": "走马灯",
"description": "常用于一组图片或卡片轮播,当内容空间不足时,可以用走马灯的形式进行收纳,进行轮播展现",
"isSelected": "true",
"id": "4c884c3d"
}
]
},
"tpl": null,
"app": "918",
"desc": null,
"created_at": "2022-07-04T03:04:05.000Z",
"updated_at": "2022-07-04T03:43:40.000Z"
},
"locale": "zh-cn"
}

View File

@ -0,0 +1,43 @@
/**
* 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 moment from 'moment'
export const E_SchemaFormatFunc = {
toLocalTimestamp(time) {
return moment(time).format('YYYY-MM-DD hh:mm:ss')
},
toRootElement(isBody) {
return isBody ? 'body' : 'div'
},
toGroupName(group) {
// 调整一下group命名
if (['static', 'public'].includes(group)) {
return `${group}Pages`
}
return group
},
toCreatorName(createdBy) {
// 历史原因 数据库中有页面的createdBy为null
return (createdBy || {}).username || ''
},
// 数字转字符串
toFormatString(param) {
return param.toString()
},
// 给global_state设置默认值
toArrayValue(state) {
return Array.isArray(state) ? state : []
}
}

View File

@ -0,0 +1,75 @@
/**
* 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 setString = (str, len) => {
let StrLen = 0
let s = ''
for (let i = 0; i < str.length; i++) {
if (str.charCodeAt(i) > 128) {
StrLen += 2
} else {
StrLen++
}
s += str.charAt(i)
if (StrLen >= len) {
return s + '...'
}
}
return s
}
// 格式化设置
export const OptionFormat = (GetOptions) => {
let options = '{'
for (let n = 0; n < GetOptions.length; n++) {
options = options + "'" + GetOptions[n].option_name + "':'" + GetOptions[n].option_value + "'"
if (n < GetOptions.length - 1) {
options = options + ','
}
}
return JSON.parse(options + '}')
}
// 数组去重
export const HovercUnique = (arr) => {
const n = {}
const r = []
for (let i = 0; i < arr.length; i++) {
if (!n[arr[i]]) {
n[arr[i]] = true
r.push(arr[i])
}
}
return r
}
// 获取json长度
export const getJsonLength = (jsonData) => {
return Object.keys(jsonData).length
}
export const getResponseData = (data, error) => {
const res = {
data
}
if (error) {
const err_code = error.code
res.error = {
code: err_code,
message: error.message
}
}
return res
}

View File

@ -0,0 +1,19 @@
/**
* 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 app from '../src/app'
describe('Example', () => {
test('should be defined', () => {
expect(app).toBeDefined()
})
})

130
package.json Normal file
View File

@ -0,0 +1,130 @@
{
"name": "@opentiny/tiny-engine",
"version": "1.0.0",
"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": [
"vue",
"vue3",
"frontend",
"opentiny",
"lowcode",
"tiny-engine"
],
"scripts": {
"dev": "cross-env NODE_OPTIONS=--max-old-space-size=10240 VITE_API_MOCK=mock vite",
"serve": "cross-env NODE_OPTIONS=--max-old-space-size=10240 vite",
"build:plugin": "lerna run build --scope @opentiny/tiny-engine-*",
"build:alpha": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build --mode alpha",
"build:prod": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build --mode prod",
"buildComponentSchemas": "node scripts/buildComponentSchemas.js",
"preview": "vite preview",
"lint": "eslint . --ext .js,.vue,.jsx --fix",
"format": "prettier --write **/*{.vue,.js,.ts,.html,.json}",
"auto:publish": "node autoPublish",
"publish:core": "npm publish",
"publish:plugin": "lerna exec npm publish --scope @opentiny/tiny-engine-*",
"version": "lerna exec npm version ${version}",
"clean": "lerna clean",
"prepare": "node -e \"if(require('fs').existsSync('.git')){process.exit(1)}\" || husky install"
},
"dependencies": {
"@babel/core": "7.18.13",
"@babel/generator": "7.18.13",
"@babel/parser": "7.18.13",
"@babel/traverse": "7.18.13",
"@opentiny/vue": "~3.9.0",
"@opentiny/vue-design-smb": "~3.9.0",
"@vue/babel-plugin-jsx": "1.1.1",
"@vue/repl": "^1.3.0",
"@vueuse/core": "^9.6.0",
"element-resize-detector": "^1.2.4",
"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",
"vue": "3.2.45",
"vue-clipboard3": "^2.0.0",
"vue-draggable-next": "2.1.0",
"vue-i18n": "9.2.2",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@babel/eslint-parser": "^7.21.3",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@opentiny/tiny-engine-canvas": "file:src/canvas",
"@opentiny/tiny-engine-common": "file:src/common",
"@opentiny/tiny-engine-controller": "file:src/controller",
"@opentiny/tiny-engine-http": "file:src/http",
"@opentiny/tiny-engine-plugin-block": "file:src/plugins/packages/block",
"@opentiny/tiny-engine-plugin-bridge": "file:src/plugins/packages/bridge",
"@opentiny/tiny-engine-plugin-data": "file:src/plugins/packages/data",
"@opentiny/tiny-engine-plugin-datasource": "file:src/plugins/packages/datasource",
"@opentiny/tiny-engine-plugin-help": "file:src/plugins/packages/help",
"@opentiny/tiny-engine-plugin-i18n": "file:src/plugins/packages/i18n",
"@opentiny/tiny-engine-plugin-materials": "file:src/plugins/packages/materials",
"@opentiny/tiny-engine-plugin-page": "file:src/plugins/packages/page",
"@opentiny/tiny-engine-plugin-schema": "file:src/plugins/packages/schema",
"@opentiny/tiny-engine-plugin-script": "file:src/plugins/packages/script",
"@opentiny/tiny-engine-plugin-tree": "file:src/plugins/packages/tree",
"@opentiny/tiny-engine-plugin-tutorial": "file:src/plugins/packages/tutorial",
"@opentiny/tiny-engine-plugin-robot": "file:src/plugins/packages/robot",
"@opentiny/tiny-engine-setting-design": "file:src/settings/packages/design",
"@opentiny/tiny-engine-setting-events": "file:src/settings/packages/events",
"@opentiny/tiny-engine-setting-props": "file:src/settings/packages/props",
"@opentiny/tiny-engine-setting-styles": "file:src/settings/packages/styles",
"@opentiny/tiny-engine-svgs": "file:src/svgs",
"@opentiny/tiny-engine-theme-dark": "file:src/theme/packages/dark",
"@opentiny/tiny-engine-theme-light": "file:src/theme/packages/light",
"@opentiny/tiny-engine-toolbar-breadcrumb": "file:src/toolbars/packages/breadcrumb",
"@opentiny/tiny-engine-toolbar-checkinout": "file:src/toolbars/packages/lock",
"@opentiny/tiny-engine-toolbar-clean": "file:src/toolbars/packages/clean",
"@opentiny/tiny-engine-toolbar-collaboration": "file:src/toolbars/packages/collaboration",
"@opentiny/tiny-engine-toolbar-fullscreen": "file:src/toolbars/packages/fullscreen",
"@opentiny/tiny-engine-toolbar-generate-vue": "file:src/toolbars/packages/generate-vue",
"@opentiny/tiny-engine-toolbar-lang": "file:src/toolbars/packages/lang",
"@opentiny/tiny-engine-toolbar-layout": "file:src/toolbars/packages/layout",
"@opentiny/tiny-engine-toolbar-logo": "file:src/toolbars/packages/logo",
"@opentiny/tiny-engine-toolbar-logout": "file:src/toolbars/packages/logout",
"@opentiny/tiny-engine-toolbar-media": "file:src/toolbars/packages/media",
"@opentiny/tiny-engine-toolbar-preview": "file:src/toolbars/packages/preview",
"@opentiny/tiny-engine-toolbar-redoundo": "file:src/toolbars/packages/redoundo",
"@opentiny/tiny-engine-toolbar-refresh": "file:src/toolbars/packages/refresh",
"@opentiny/tiny-engine-toolbar-save": "file:src/toolbars/packages/save",
"@opentiny/tiny-engine-toolbar-setting": "file:src/toolbars/packages/setting",
"@opentiny/tiny-engine-utils": "file:src/utils",
"@opentiny/tiny-engine-webcomponent-core": "file:src/webcomponent",
"@opentiny/tiny-engine-i18n-host": "file:src/i18n",
"@types/node": "^18.0.0",
"@vitejs/plugin-vue": "^4.2.3",
"@vitejs/plugin-vue-jsx": "^1.3.2",
"assert": "^2.0.0",
"buffer": "^6.0.3",
"cross-env": "^7.0.3",
"eslint": "^8.38.0",
"eslint-plugin-vue": "^8.0.0",
"fs-extra": "^10.1.0",
"husky": "^8.0.0",
"lerna": "^5.1.8",
"less": "^4.1.2",
"lint-staged": "^13.2.0",
"path": "^0.12.7",
"rimraf": "^3.0.2",
"rollup-plugin-polyfill-node": "^0.12.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-visualizer": "^5.8.3",
"svg-sprite-loader": "^6.0.11",
"vite": "^4.3.7",
"vite-plugin-monaco-editor": "^1.0.10",
"vite-plugin-svg-icons": "^2.0.1",
"vue-eslint-parser": "^8.0.1"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

View File

@ -0,0 +1,18 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')
module.exports = {
root: true,
extends: ['plugin:vue/vue3-essential', 'eslint:recommended', '@vue/eslint-config-prettier'],
env: {
'vue/setup-compiler-macros': true,
browser: true,
es2015: true,
node: true
},
parserOptions: {
ecmaFeatures: {
jsx: true
}
}
}

View File

@ -0,0 +1,12 @@
{
"compilerOptions": {
"baseUrl": "./",
"target": "ES6",
"module": "CommonJS",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}

Some files were not shown because too many files have changed in this diff Show More