Compare commits
1 Commits
develop
...
atom-2024/
Author | SHA1 | Date |
---|---|---|
yz-yu | 9a12bf3c2f |
|
@ -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'
|
||||
|
|
@ -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
|
|
@ -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
|
|
@ -0,0 +1,5 @@
|
|||
SQL_HOST=localhost
|
||||
SQL_PORT=3306
|
||||
SQL_USER=root
|
||||
SQL_PASSWORD=admin
|
||||
SQL_DATABASE=tiny_engine
|
|
@ -0,0 +1,9 @@
|
|||
.vscode
|
||||
dist
|
||||
public
|
||||
package-lock.json
|
||||
**/node_modules/**
|
||||
tmp
|
||||
temp
|
||||
mockServer
|
||||
packages/vue-generator/**/output/**
|
|
@ -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: '^_' }]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
name: '🐛 Bug report'
|
||||
description: Create a report to help us improve Tiny Engine
|
||||
title: '🐛 [Bug]: '
|
||||
labels: ['🐛 bug']
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Please fill out the following carefully in order to better fix the problem.
|
||||
- type: input
|
||||
id: Environment
|
||||
attributes:
|
||||
label: Environment
|
||||
description: |
|
||||
**Depending on your browser and operating system, websites may behave differently from one environment to another. Make sure your developers know your technical environment.**
|
||||
placeholder: Please browser information.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: node-version
|
||||
attributes:
|
||||
label: Version
|
||||
description: |
|
||||
### **Check if the issue is reproducible with the latest stable version.**
|
||||
You can use the command `node -v` to view it
|
||||
placeholder: latest
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: tiny-vue-version
|
||||
attributes:
|
||||
label: Version
|
||||
description: |
|
||||
### **Check if the issue is reproducible with the latest stable version.**
|
||||
You can use the command `npm ls @opentiny/vue` to view it
|
||||
placeholder: latest
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: minimal-repo
|
||||
attributes:
|
||||
label: Link to minimal reproduction
|
||||
description: |
|
||||
**Provide a streamlined CodePen / CodeSandbox or GitHub repository link as much as possible. Please don't fill in a link randomly, it will only close your issue directly.**
|
||||
placeholder: Please Input
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
attributes:
|
||||
label: Step to reproduce
|
||||
description: |
|
||||
**After the replay is turned on, what actions do we need to perform to make the bug appear? Simple and clear steps can help us locate the problem more quickly. Please clearly describe the steps of reproducing the issue. Issues without clear reproducing steps will not be repaired. If the issue marked with 'need reproduction' does not provide relevant steps within 7 days, it will be closed directly.**
|
||||
placeholder: Please Input
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: What is expected
|
||||
placeholder: Please Input
|
||||
- type: textarea
|
||||
id: actually
|
||||
attributes:
|
||||
label: What is actually happening
|
||||
placeholder: Please Input
|
||||
- type: input
|
||||
id: project-name
|
||||
attributes:
|
||||
label: What is your project name
|
||||
description: We also welcome you to fill in more detailed project information in the following issue [#334](https://github.com/opentiny/tiny-engine/issues/334).
|
||||
placeholder: Please Input
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: additional-comments
|
||||
attributes:
|
||||
label: Any additional comments (optional)
|
||||
description: |
|
||||
**Some background / context of how you ran into this bug.**
|
||||
placeholder: Please Input
|
|
@ -0,0 +1,5 @@
|
|||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Questions or need help
|
||||
url: https://github.com/opentiny/tiny-engine/discussions
|
||||
about: Add this WeChat(opentiny-official), we will invite you to the WeChat discussion group later.
|
|
@ -0,0 +1,31 @@
|
|||
name: ✨ Feature Request
|
||||
description: Propose new features to @opentiny/tiny-engine to improve it.
|
||||
title: '✨ [Feature]: '
|
||||
labels: ['✨ feature']
|
||||
body:
|
||||
- type: textarea
|
||||
id: feature-solve
|
||||
attributes:
|
||||
label: What problem does this feature solve
|
||||
description: |
|
||||
Explain your use case, context, and rationale behind this feature request. More importantly, what is the end user experience you are trying to build that led to the need for this feature?
|
||||
placeholder: Please Input
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: feature-api
|
||||
attributes:
|
||||
label: What does the proposed API look like
|
||||
description: |
|
||||
Describe how you propose to solve the problem and provide code samples of how the API would work once implemented. Note that you can use Markdown to format your code blocks.
|
||||
placeholder: Please Input
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: project-name
|
||||
attributes:
|
||||
label: What is your project name
|
||||
description: We also welcome you to fill in more detailed project information in the following issue [#334](https://github.com/opentiny/tiny-engine/issues/334).
|
||||
placeholder: Please Input
|
||||
validations:
|
||||
required: true
|
|
@ -0,0 +1,52 @@
|
|||
English | [简体中文](https://github.com/opentiny/tiny-engine/blob/develop/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.zh-CN.md)
|
||||
|
||||
# PR
|
||||
|
||||
## PR Checklist
|
||||
|
||||
Please check if your PR fulfills the following requirements:
|
||||
|
||||
- [ ] The commit message follows our [Commit Message Guidelines](https://github.com/opentiny/tiny-engine/blob/develop/CONTRIBUTING.md)
|
||||
- [ ] Tests for the changes have been added (for bug fixes / features)
|
||||
- [ ] Docs have been added / updated (for bug fixes / features)
|
||||
- [ ] Built its own designer, fully self-validated
|
||||
|
||||
## PR Type
|
||||
|
||||
What kind of change does this PR introduce?
|
||||
|
||||
<!-- Please check the one that applies to this PR using "x". -->
|
||||
|
||||
- [ ] Bugfix
|
||||
- [ ] Feature
|
||||
- [ ] Code style update (formatting, local variables)
|
||||
- [ ] Refactoring (no functional changes, no api changes)
|
||||
- [ ] Build related changes
|
||||
- [ ] CI related changes
|
||||
- [ ] Documentation content changes
|
||||
- [ ] Other... Please describe:
|
||||
|
||||
## Background and solution
|
||||
<!--
|
||||
1. Describe the problem and the scenario.
|
||||
2. New features need to be described and attached with renderings.
|
||||
3. Screenshots or GIFs involving UI/Interaction changes/Bugfix before and after modification are required.
|
||||
-->
|
||||
|
||||
### What is the current behavior?
|
||||
|
||||
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
|
||||
|
||||
Issue Number: N/A
|
||||
|
||||
### What is the new behavior?
|
||||
|
||||
|
||||
## Does this PR introduce a breaking change?
|
||||
|
||||
- [ ] Yes
|
||||
- [ ] No
|
||||
|
||||
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
|
||||
|
||||
## Other information
|
|
@ -0,0 +1,52 @@
|
|||
[English](https://github.com/opentiny/tiny-engine/blob/develop/.github/PULL_REQUEST_TEMPLATE.md) | 简体中文
|
||||
|
||||
# PR
|
||||
|
||||
## PR Checklist
|
||||
|
||||
请检查您的 PR 是否满足以下要求:
|
||||
|
||||
- [ ] commit message遵循我们的[提交贡献指南](https://github.com/opentiny/tiny-engine/blob/develop/CONTRIBUTING.md)
|
||||
- [ ] 添加了更改内容的测试用例(用于bugfix/功能)
|
||||
- [ ] 文档已添加/更新(用于bugfix/功能)
|
||||
- [ ] 是否构建了自己的设计器,经过了充分的自验证
|
||||
|
||||
## PR 类型
|
||||
|
||||
这个PR的类型是?
|
||||
|
||||
- [ ] 日常 bug 修复
|
||||
- [ ] 新特性支持
|
||||
- [ ] 代码风格优化
|
||||
- [ ] 重构
|
||||
- [ ] 构建优化
|
||||
- [ ] 测试用例
|
||||
- [ ] 文档更新
|
||||
- [ ] 分支合并
|
||||
- [ ] 其他改动(请补充)
|
||||
|
||||
|
||||
## 需求背景和解决方案
|
||||
|
||||
<!--
|
||||
1. 要解决的具体问题。
|
||||
2. 新增特性,需要进行功能描述,并附上效果图。
|
||||
3. 涉及UI/交互变动/Bugfix需要有修改前&修改后截图或 GIF。
|
||||
-->
|
||||
|
||||
|
||||
Issue Number: N/A
|
||||
|
||||
### 修改前
|
||||
|
||||
|
||||
### 修改后
|
||||
|
||||
## 此PR是否含有 breaking change?
|
||||
|
||||
- [ ] 是
|
||||
- [ ] 否
|
||||
|
||||
<!-- 如果此 PR 包含breaking change,请在下面从用户角度描述具体变化和其他风险。-->
|
||||
|
||||
## Other information
|
|
@ -0,0 +1,26 @@
|
|||
changelog:
|
||||
exclude:
|
||||
labels:
|
||||
- ignore-for-release
|
||||
authors:
|
||||
- allcontributors[bot]
|
||||
categories:
|
||||
- title: Breaking Changes 🛠
|
||||
labels:
|
||||
- Semver-Major
|
||||
- breaking-change
|
||||
- title: Exciting New Features 🎉
|
||||
labels:
|
||||
- Semver-Minor
|
||||
- feature
|
||||
- enhancement
|
||||
- title: Bug Fixes 🐛
|
||||
labels:
|
||||
- Semver-Patch
|
||||
- bug
|
||||
- title: Other Changes
|
||||
labels:
|
||||
- documentation
|
||||
- refactoring
|
||||
- unit-test
|
||||
- ci
|
|
@ -0,0 +1,23 @@
|
|||
name: AI Code Review
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
|
||||
jobs:
|
||||
review:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: anc95/ChatGPT-CodeReview@main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
LANGUAGE: Chinese
|
||||
OPENAI_API_ENDPOINT: https://api.openai.com/v1
|
||||
MODEL: gpt-3.5-turbo
|
||||
MAX_TOKENS: 4096
|
||||
MAX_PATCH_LENGTH: 10000
|
|
@ -0,0 +1,18 @@
|
|||
name: 'issue-translator'
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: usthe/issues-translate-action@v2.7
|
||||
with:
|
||||
IS_MODIFY_TITLE: false
|
||||
# 非必须,决定是否需要修改issue标题内容
|
||||
# 若是true,则机器人账户@Issues-translate-bot必须拥有修改此仓库issue权限。可以通过邀请@Issues-translate-bot加入仓库协作者实现。
|
||||
CUSTOM_BOT_NOTE: Bot detected the issue body's language is not English, translate it automatically.
|
||||
# 非必须,自定义机器人翻译的前缀开始内容。
|
|
@ -0,0 +1,36 @@
|
|||
name: Push And Create PR Check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: []
|
||||
pull_request:
|
||||
branches: [develop,main]
|
||||
|
||||
jobs:
|
||||
push-check:
|
||||
runs-on: ubuntu-latest # windows-latest || macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm i -g pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm i
|
||||
|
||||
- name: Get changed files
|
||||
id: get_changed_files
|
||||
uses: tj-actions/changed-files@v40
|
||||
with:
|
||||
files: |
|
||||
**.js
|
||||
**.vue
|
||||
**.jsx
|
||||
- name: Run ESLint
|
||||
run: npx eslint ${{steps.get_changed_files.outputs.all_changed_files}}
|
||||
- name: Run Build
|
||||
run: pnpm run build:plugin && pnpm run build:alpha
|
|
@ -0,0 +1,28 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
dist/
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
pnpm-lock.yaml
|
||||
lerna-debug.log
|
||||
|
||||
# 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
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
# npm run lint
|
||||
npx lint-staged -q
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
.build_config
|
||||
.cid
|
||||
.codecheck
|
||||
.husky
|
||||
.vscode
|
||||
# 只忽略根目录的 dist 文件夹
|
||||
/dist
|
||||
test
|
||||
node_modules
|
||||
.editorconfig
|
||||
.eslintignore
|
||||
.eslintrc.js
|
||||
.prettierignore
|
||||
.prettierrc
|
||||
jsconfig.json
|
||||
package-lock.json
|
||||
|
||||
# 忽略可能存在的其它编辑器文件夹
|
||||
.idea
|
||||
|
||||
/packages/design-core/public/mock/*
|
||||
**/**/tmp
|
||||
**/**/temp
|
|
@ -0,0 +1,3 @@
|
|||
dist
|
||||
package-lock.json
|
||||
**/node_modules/**
|
|
@ -0,0 +1,5 @@
|
|||
semi: false
|
||||
singleQuote: true
|
||||
printWidth: 120
|
||||
trailingComma: 'none'
|
||||
endOfLine: 'auto'
|
|
@ -0,0 +1,17 @@
|
|||
# 更新日志
|
||||
|
||||
## v1.0.0-alpha.0
|
||||
|
||||
`2023/09/25`
|
||||
|
||||
### 📢 破坏性变更
|
||||
|
||||
无
|
||||
|
||||
### ✨ 新特性
|
||||
|
||||
- 首个版本提交
|
||||
|
||||
### 🐞 缺陷修复
|
||||
|
||||
无
|
|
@ -0,0 +1,80 @@
|
|||
# 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
|
||||
pnpm i
|
||||
|
||||
# Start the project.
|
||||
$ pnpm 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 develop`.
|
||||
- Open the [Pull requests](https://github.com/opentiny/tiny-engine/pulls) link of the TinyEngine code repository and click the New pull request button to submit the PR.
|
||||
- Project Committer conducts Code Review and makes comments.
|
||||
- The PR author adjusts the code according to the opinion. Please note that when a branch initiates PR, the subsequent commit will be synchronized automatically, and there is no need to resubmit the PR.
|
||||
- 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
|
|
@ -0,0 +1,79 @@
|
|||
# 贡献指南
|
||||
|
||||
很高兴你有意愿参与 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 根目录下运行 `pnpm i`, 安装依赖
|
||||
- 在 TinyEngine 根目录下运行 `pnpm dev`,启动本地开发
|
||||
|
||||
```shell
|
||||
# username 为用户名,执行前请替换
|
||||
git clone git@github.com:username/tiny-engine.git
|
||||
cd tiny-engine
|
||||
git remote add upstream git@github.com:opentiny/tiny-engine.git
|
||||
pnpm i
|
||||
|
||||
# 启动项目
|
||||
$ pnpm dev
|
||||
|
||||
```
|
||||
|
||||
提交 PR 的步骤:
|
||||
|
||||
- 创建新分支 `git checkout -b username/feature1`,分支名字建议为 `username/feat-xxx` / `username/fix-xxx`
|
||||
- 本地编码
|
||||
- 遵循 Commit Message Format 规范进行提交,不符合提交规范的 PR 将不会被合并
|
||||
- 提交到远程仓库:git push origin branchName
|
||||
- (可选)同步上游仓库 develop 分支最新代码:git pull upstream develop
|
||||
- 打开 TinyEngine 代码仓库的 [Pull requests](https://github.com/opentiny/tiny-engine/pulls) 链接,点击 New pull request 按钮提交 PR
|
||||
- 项目 Committer 进行 Code Review,并提出意见
|
||||
- PR 作者根据意见调整代码,请注意一个分支发起了 PR 后,后续的 commit 会自动同步,无需重新提交 PR
|
||||
- 项目管理员合并 PR
|
||||
|
||||
贡献流程结束,感谢你的贡献!
|
||||
|
||||
## 加入开源社区
|
||||
|
||||
如果你对我们的开源项目感兴趣,欢迎通过以下方式加入我们的开源社区。
|
||||
|
||||
- 添加官方小助手微信:opentiny-official,加入我们的技术交流群
|
||||
- 加入邮件列表:opentiny@googlegroups.com
|
|
@ -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.
|
108
README.md
|
@ -1,2 +1,108 @@
|
|||
# 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.
|
||||
|
||||
## Documentation
|
||||
|
||||
- intro:https://opentiny.design/tiny-engine#/home
|
||||
- tutorial:https://opentiny.design/tiny-engine#/help-center/course/engine
|
||||
- playground:https://opentiny.design/tiny-engine#/tiny-engine-editor
|
||||
|
||||
## Development
|
||||
|
||||
### Dependencies required for installation
|
||||
|
||||
```sh
|
||||
$ pnpm install
|
||||
```
|
||||
|
||||
### Local development: Start the local mock server and use the mock data of the local mock server.
|
||||
|
||||
```sh
|
||||
$ pnpm dev
|
||||
```
|
||||
|
||||
## Local development, directly connected to the local tiny-engine-webservice server
|
||||
|
||||
1. Start <a href="https://github.com/opentiny/tiny-engine-data-center/blob/main/README.md" target="_blank">tiny-engine-data-center</a>
|
||||
|
||||
2. Start <a href="https://github.com/opentiny/tiny-engine-webservice/blob/main/README.md" target="_blank">tiny-engine-webservice</a>
|
||||
|
||||
3. Modify the origin value in `vite.config.js` in the `packages/design-core/` directory of the tiny-engine project to be the address port of your local webService project (the webService port defaults to 7011), such as:
|
||||
|
||||
<img alt="Modify port" src="https://res.hc-cdn.com/lowcode-portal/1.1.55/img/docimg/backend_deploy_5.png">
|
||||
|
||||
|
||||
### Materials Synchronization [Solution](https://opentiny.design/tiny-engine#/help-center/course/engine/56)
|
||||
|
||||
```sh
|
||||
$ pnpm splitMaterials
|
||||
```
|
||||
|
||||
```sh
|
||||
$ pnpm buildMaterials
|
||||
```
|
||||
|
||||
Open a browser: `http://localhost:8080/?type=app&id=918&tenant=1&pageid=NTJ4MjvqoVj8OVsc`
|
||||
`url search` Parameters:
|
||||
|
||||
- `type=app` Application type
|
||||
- `id=xxx` Application ID
|
||||
- `tenant=xxx` Organization ID
|
||||
- `pageid=xxx` Page ID
|
||||
|
||||
## Build
|
||||
|
||||
```sh
|
||||
# Build all plug-ins first
|
||||
pnpm build:plugin
|
||||
|
||||
# Build Designer
|
||||
pnpm build:alpha or build:prod
|
||||
|
||||
```
|
||||
The folder where the product is located after building
|
||||
```
|
||||
tiny-engine/packages/design-core/dist/
|
||||
```
|
||||
|
||||
## Milestones
|
||||
|
||||
```mermaid
|
||||
gantt
|
||||
dateFormat YYYY-MM-DD
|
||||
axisFormat %Y-%m-%d
|
||||
|
||||
1.0.0-beta.x version :active,2023-09-25, 2024-03-31
|
||||
1.0.0-rc version : 2024-04-01, 2024-06-30
|
||||
1.0.0 version : 2024-07-01, 2024-07-31
|
||||
|
||||
```
|
||||
|
||||
## 🤝 Participation and Contribution
|
||||
|
||||
If you are interested in our open source project, please join us! 🎉
|
||||
|
||||
Please read the [Contribution Guide](CONTRIBUTING.md) before participating in the contribution.
|
||||
|
||||
- Add official assistant WeChat opentiny-official and join the technical exchange group
|
||||
- Join the mailing list opentiny@googlegroups.com
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
<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 大模型能力,辅助开发者构建应用
|
||||
|
||||
## 文档
|
||||
|
||||
- 介绍:https://opentiny.design/tiny-engine#/home
|
||||
- 使用文档:https://opentiny.design/tiny-engine#/help-center/course/engine
|
||||
- 演示应用:https://opentiny.design/tiny-engine#/tiny-engine-editor
|
||||
|
||||
## 开发
|
||||
|
||||
### 安装所需的依赖
|
||||
|
||||
```sh
|
||||
$ pnpm install
|
||||
```
|
||||
|
||||
### 本地开发,启动本地 mock 服务器,使用本地 mock 服务器的 mock 数据
|
||||
|
||||
```sh
|
||||
$ pnpm dev
|
||||
```
|
||||
|
||||
### 本地开发,直连本地的tiny-engine-webservice服务端
|
||||
|
||||
1. 启动 <a href="https://github.com/opentiny/tiny-engine-data-center/blob/main/README.md" target="_blank">tiny-engine-data-center</a>
|
||||
|
||||
2. 启动 <a href="https://github.com/opentiny/tiny-engine-webservice/blob/main/README.md" target="_blank">tiny-engine-webservice</a>
|
||||
|
||||
3. 修改 tiny-engine 项目 `packages/design-core/` 目录下 `vite.config.js` 中origin的值为自己本地webService项目的地址端口(webService端口默认为7011),如:
|
||||
|
||||
<img alt="修改端口" src="https://res.hc-cdn.com/lowcode-portal/1.1.55/img/docimg/backend_deploy_5.png">
|
||||
|
||||
|
||||
### 物料同步[方案](https://opentiny.design/tiny-engine#/help-center/course/engine/56)
|
||||
|
||||
```sh
|
||||
$ pnpm splitMaterials
|
||||
```
|
||||
|
||||
```sh
|
||||
$ pnpm buildMaterials
|
||||
```
|
||||
|
||||
浏览器打开:`http://localhost:8080/?type=app&id=918&tenant=1&pageid=NTJ4MjvqoVj8OVsc`
|
||||
`url search`参数:
|
||||
|
||||
- `type=app` 应用类型
|
||||
- `id=xxx` 应用 ID
|
||||
- `tenant=xxx` 组织 ID
|
||||
- `pageid=xxx` 页面 ID
|
||||
|
||||
## 构建
|
||||
|
||||
```sh
|
||||
# 先构建所有插件
|
||||
pnpm run build:plugin
|
||||
|
||||
# 构建设计器
|
||||
pnpm run build:alpha 或 build:prod
|
||||
|
||||
```
|
||||
构建后产物所在文件夹
|
||||
```
|
||||
tiny-engine/packages/design-core/dist/
|
||||
```
|
||||
|
||||
## 里程碑
|
||||
|
||||
```mermaid
|
||||
gantt
|
||||
dateFormat YYYY-MM-DD
|
||||
axisFormat %Y-%m-%d
|
||||
|
||||
1.0.0-beta.x version :active,2023-09-25, 2024-03-31
|
||||
1.0.0-rc version : 2024-04-01, 2024-06-30
|
||||
1.0.0 version : 2024-07-01, 2024-07-31
|
||||
|
||||
```
|
||||
|
||||
## 🤝 参与贡献
|
||||
|
||||
如果你对我们的开源项目感兴趣,欢迎加入我们!🎉
|
||||
|
||||
参与贡献之前请先阅读[贡献指南](CONTRIBUTING.zh-CN.md)。
|
||||
|
||||
- 添加官方小助手微信 opentiny-official,加入技术交流群
|
||||
- 加入邮件列表 opentiny@googlegroups.com
|
||||
|
||||
## 开源协议
|
||||
|
||||
[MIT](LICENSE)
|
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"jsx": "react",
|
||||
"paths": {
|
||||
"@/*": ["packages/*"],
|
||||
"@opentiny/tiny-engine-canvas": ["packages/canvas/src/index.js"],
|
||||
"@opentiny/tiny-engine-controller": ["packages/controller/src/index"],
|
||||
"@opentiny/tiny-engine-plugin-materials": ["packages/plugins/materials/index"],
|
||||
"@opentiny/tiny-engine-plugin-data": ["packages/plugins/data/index"],
|
||||
"@opentiny/tiny-engine-plugin-script": ["packages/plugins/script/index"],
|
||||
"@opentiny/tiny-engine-plugin-tree": ["packages/plugins/tree/index"],
|
||||
"@opentiny/tiny-engine-plugin-help": ["packages/plugins/help/index"],
|
||||
"@opentiny/tiny-engine-plugin-schema": ["packages/plugins/schema/index"],
|
||||
"@opentiny/tiny-engine-plugin-page": ["packages/plugins/page/index"],
|
||||
"@opentiny/tiny-engine-plugin-i18n": ["packages/plugins/i18n/index"],
|
||||
"@opentiny/tiny-engine-plugin-bridge": ["packages/plugins/bridge/index"],
|
||||
"@opentiny/tiny-engine-setting-events": ["packages/settings/events/index"],
|
||||
"@opentiny/tiny-engine-setting-props": ["packages/settings/props/index"],
|
||||
"@opentiny/tiny-engine-common": ["packages/common/index"],
|
||||
"@opentiny/tiny-engine-setting-styles": ["packages/settings/styles/index"],
|
||||
"@opentiny/tiny-engine-toolbar-breadcrumb": ["packages/toolbars/breadcrumb/index"],
|
||||
"@opentiny/tiny-engine-toolbar-fullscreen": ["packages/toolbars/fullscreen/index"],
|
||||
"@opentiny/tiny-engine-toolbar-lang": ["packages/toolbars/lang/index"],
|
||||
"@opentiny/tiny-engine-toolbar-layout": ["packages/toolbars/layout/index"],
|
||||
"@opentiny/tiny-engine-toolbar-checkinout": ["packages/toolbars/lock/index"],
|
||||
"@opentiny/tiny-engine-toolbar-logo": ["packages/toolbars/logo/index"],
|
||||
"@opentiny/tiny-engine-toolbar-media": ["packages/toolbars/media/index"],
|
||||
"@opentiny/tiny-engine-toolbar-preview": ["packages/toolbars/preview/index"],
|
||||
"@opentiny/tiny-engine-toolbar-generate-vue": ["packages/toolbars/generate-vue/index"],
|
||||
"@opentiny/tiny-engine-toolbar-clean": ["packages/toolbars/clean/index"],
|
||||
"@opentiny/tiny-engine-toolbar-save": ["packages/toolbars/save/index"],
|
||||
"tiny-engine-canvas": ["packages/canvas/index"],
|
||||
"@opentiny/tiny-engine-theme-dark": ["packages/theme/dark/index.less"],
|
||||
"@opentiny/tiny-engine-theme-light": ["packages/theme/light/index.less"],
|
||||
"@opentiny/tiny-engine-svgs": ["packages/svgs/index"],
|
||||
"@opentiny/tiny-engine-http": ["packages/http/index"],
|
||||
"@opentiny/tiny-engine-controller/*": ["packages/controller/src/*"],
|
||||
"@opentiny/tiny-engine-plugin-materials/*": ["packages/plugins/materials/*"],
|
||||
"@opentiny/tiny-engine-plugin-data/*": ["packages/plugins/data/*"],
|
||||
"@opentiny/tiny-engine-plugin-script/*": ["packages/plugins/script/*"],
|
||||
"@opentiny/tiny-engine-plugin-tree/*": ["packages/plugins/tree/*"],
|
||||
"@opentiny/tiny-engine-plugin-help/*": ["packages/plugins/help/*"],
|
||||
"@opentiny/tiny-engine-plugin-schema/*": ["packages/plugins/schema/*"],
|
||||
"@opentiny/tiny-engine-plugin-page/*": ["packages/plugins/page/*"],
|
||||
"@opentiny/tiny-engine-plugin-i18n/*": ["packages/plugins/i18n/*"],
|
||||
"@opentiny/tiny-engine-plugin-bridge/*": ["packages/plugins/bridge/*"],
|
||||
"@opentiny/tiny-engine-setting-events/*": ["packages/settings/events/*"],
|
||||
"@opentiny/tiny-engine-setting-props/*": ["packages/settings/props/*"],
|
||||
"@opentiny/tiny-engine-common/*": ["packages/common/*"],
|
||||
"@opentiny/tiny-engine-setting-styles/*": ["packages/settings/styles/*"],
|
||||
"@opentiny/tiny-engine-toolbar-breadcrumb/*": ["packages/toolbars/breadcrumb/*"],
|
||||
"@opentiny/tiny-engine-toolbar-fullscreen/*": ["packages/toolbars/fullscreen/*"],
|
||||
"@opentiny/tiny-engine-toolbar-lang/*": ["packages/toolbars/lang/*"],
|
||||
"@opentiny/tiny-engine-toolbar-layout/*": ["packages/toolbars/layout/*"],
|
||||
"@opentiny/tiny-engine-toolbar-checkinout/*": ["packages/toolbars/lock/*"],
|
||||
"@opentiny/tiny-engine-toolbar-logo/*": ["packages/toolbars/logo/*"],
|
||||
"@opentiny/tiny-engine-toolbar-media/*": ["packages/toolbars/media/*"],
|
||||
"@opentiny/tiny-engine-toolbar-preview/*": ["packages/toolbars/preview/*"],
|
||||
"@opentiny/tiny-engine-toolbar-clean/*": ["packages/toolbars/clean/*"],
|
||||
"@opentiny/tiny-engine-toolbar-save/*": ["packages/toolbars/save/*"],
|
||||
"@opentiny/tiny-engine-theme-dark/*": ["packages/theme/dark/*"],
|
||||
"@opentiny/tiny-engine-theme-light/*": ["packages/theme/light/*"],
|
||||
"@opentiny/tiny-engine-svgs/*": ["packages/svgs/*"],
|
||||
"@opentiny/tiny-engine-http/*": ["packages/http/*"],
|
||||
"@opentiny/tiny-engine-utils": ["packages/utils/src/index.js"],
|
||||
"@opentiny/tiny-engine-webcomponent-core": ["packages/webcomponent/src/lib"],
|
||||
"@opentiny/tiny-engine-i18n-host": ["packages/i18n/src/lib"]
|
||||
}
|
||||
},
|
||||
"include": ["packages/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"command": {
|
||||
"version": {
|
||||
"message": "chore(release): publish"
|
||||
}
|
||||
},
|
||||
"useNx": false,
|
||||
"version": "independent",
|
||||
"npmClient": "pnpm",
|
||||
"publish": {
|
||||
"npmClient": "pnpm"
|
||||
},
|
||||
"ignoreChanges": ["**/*.md", "**/test/**", ".npmrc"],
|
||||
"granularPathspec": false
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
'./packages/**/**.{js,vue,jsx}': 'eslint',
|
||||
'./packages/**/**.{vue,js,ts,html,json,less}': 'prettier --write'
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="189px" height="38px" viewBox="0 0 189 38" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>logo-top</title>
|
||||
<defs>
|
||||
<linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="linearGradient-1">
|
||||
<stop stop-color="#FFCC00" offset="0%"></stop>
|
||||
<stop stop-color="#FF9D00" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
<linearGradient x1="41.5583977%" y1="684.931472%" x2="57.6489702%" y2="214.83809%" id="linearGradient-2">
|
||||
<stop stop-color="#5073E5" offset="0%"></stop>
|
||||
<stop stop-color="#5E7CE0" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
<linearGradient x1="44.74774%" y1="89.3284133%" x2="67.1281333%" y2="0%" id="linearGradient-3">
|
||||
<stop stop-color="#5073E5" offset="0%"></stop>
|
||||
<stop stop-color="#5E7CE0" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
<linearGradient x1="42.185134%" y1="684.931472%" x2="57.0810819%" y2="214.83809%" id="linearGradient-4">
|
||||
<stop stop-color="#5073E5" offset="0%"></stop>
|
||||
<stop stop-color="#5E7CE0" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
<linearGradient x1="24.3954947%" y1="56.7227863%" x2="68.844278%" y2="32.8834171%" id="linearGradient-5">
|
||||
<stop stop-color="#FFFFFF" stop-opacity="0" offset="0%"></stop>
|
||||
<stop stop-color="#566DB8" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Tiny-Design-首页" transform="translate(-106.000000, -20.000000)">
|
||||
<g id="导航" transform="translate(0.000000, 1.000000)">
|
||||
<g id="logo-top" transform="translate(106.000000, 19.000000)">
|
||||
<text id="OpenTiny" font-family="HiraginoSans-W7, Hiragino Sans" font-size="21" font-weight="bold" fill="#242424">
|
||||
<tspan x="76.2305" y="24">OpenTiny</tspan>
|
||||
</text>
|
||||
<g id="编组-21">
|
||||
<polygon id="路径" fill="url(#linearGradient-1)" points="61 1.99723278 44.8967008 0 20.1759284 1.37793579 32.933574 3.7061054"></polygon>
|
||||
<polygon id="路径" fill="url(#linearGradient-2)" points="50.0936029 6.53938911 50.0817739 30.0300979 61 27.7599874 60.9645128 5.58721999"></polygon>
|
||||
<polygon id="路径" fill="url(#linearGradient-3)" points="32.9710327 33.587185 45.3264901 31.154509 45.3304331 6.99805594 32.9197734 7.92893672"></polygon>
|
||||
<polygon id="路径" fill="url(#linearGradient-4)" points="20.1759284 4.76471618 20.2212732 25.8982258 32.4801266 33.3936547 32.4584399 7.93"></polygon>
|
||||
<polygon id="路径" fill="url(#linearGradient-5)" points="20.1759284 25.9101141 9.22524348e-13 29.863332 11.645719 38 32.9710327 33.587185"></polygon>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.0 KiB |
|
@ -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"]
|
||||
}
|
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
build/*.js
|
||||
assets/*.js
|
||||
test/**/*.js
|
|
@ -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'
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -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
|
||||
}
|
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 992 B |
After Width: | Height: | Size: 13 KiB |
|
@ -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())
|
||||
const _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)
|
||||
])
|
||||
])
|
||||
)
|
||||
}
|
||||
const 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 }
|
|
@ -0,0 +1,137 @@
|
|||
/**
|
||||
* 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) {
|
||||
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
||||
module.exports = factory(
|
||||
require('@opentiny/tiny-engine-webcomponent-core'),
|
||||
require('vue'),
|
||||
require('vue-i18n'),
|
||||
require('@opentiny/vue-icon')
|
||||
)
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define(['@opentiny/tiny-engine-webcomponent-core', 'vue', 'vue-i18n', '@opentiny/vue-icon'], factory)
|
||||
} else {
|
||||
;(global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||
(global.TinyVueBlock = factory(global.TinyWebcomponentCore, global.Vue, global.VueI18n, global.TinyVueIcon))
|
||||
}
|
||||
})(this, (tinyWebcomponentCore, vue, vueI18n, tinyVue3Icon) => {
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e
|
||||
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } })
|
||||
if (e) {
|
||||
Object.keys(e).forEach((k) => {
|
||||
if (k !== 'default') {
|
||||
const 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)
|
||||
}
|
||||
const 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())
|
||||
const _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)
|
||||
])
|
||||
])
|
||||
)
|
||||
}
|
||||
const 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
|
||||
})
|
|
@ -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 }
|
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
* 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) {
|
||||
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
||||
module.exports = factory(require('@opentiny/vue'))
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define(['@opentiny/vue'], factory)
|
||||
} else {
|
||||
;(global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||
(global.TinyLowcodeComponent = factory(global.TinyVue))
|
||||
}
|
||||
})(this, (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
|
||||
})
|
|
@ -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())
|
||||
const _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'
|
||||
const _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) {
|
||||
let _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
|
||||
})
|
||||
])
|
||||
)
|
||||
}
|
||||
const 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 }
|
|
@ -0,0 +1,718 @@
|
|||
/**
|
||||
* 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) {
|
||||
if (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')
|
||||
)
|
||||
} else if (typeof define === 'function ' && define.amd) {
|
||||
define([
|
||||
'@opentiny/tiny-engine-webcomponent-core',
|
||||
'vue',
|
||||
'vue-i18n',
|
||||
'@opentiny/vue-icon',
|
||||
'@opentiny/vue'
|
||||
], factory)
|
||||
} else {
|
||||
;(global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||
(global.TinyVueBlock = factory(
|
||||
global.TinyWebcomponentCore,
|
||||
global.Vue,
|
||||
global.VueI18n,
|
||||
global.TinyVueIcon,
|
||||
global.TinyVue
|
||||
))
|
||||
}
|
||||
})(this, (tinyWebcomponentCore, vue, vueI18n, tinyVue3Icon, tinyVue3) => {
|
||||
'use strict '
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e
|
||||
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module ' } })
|
||||
if (e) {
|
||||
Object.keys(e).forEach((k) => {
|
||||
if (k !== 'default ') {
|
||||
const 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)
|
||||
}
|
||||
const 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())
|
||||
const _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 '
|
||||
const _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) {
|
||||
let _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
|
||||
})
|
||||
])
|
||||
)
|
||||
}
|
||||
const 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
|
||||
})
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -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')
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright (c) 2023 - present TinyEngine Authors.
|
||||
* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license.
|
||||
*
|
||||
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
|
||||
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
|
||||
*
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
port: process.env.MOCK_PORT || 9090,
|
||||
env: process.env.NODE_ENV || 'development' // Current mode
|
||||
}
|
|
@ -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 seconds:stream.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 seconds:stream.emit('restart', 20)
|
||||
})
|
||||
})
|
|
@ -0,0 +1 @@
|
|||
ok
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"name": "@opentiny/tiny-engine-mock",
|
||||
"version": "1.0.3",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"description": "mock服务",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/opentiny/tiny-engine",
|
||||
"directory": "mockServer"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/opentiny/tiny-engine/issues"
|
||||
},
|
||||
"author": "OpenTiny Team",
|
||||
"license": "MIT",
|
||||
"homepage": "https://opentiny.design/tiny-engine",
|
||||
"scripts": {
|
||||
"start": "gulp nodemon",
|
||||
"dev": "gulp",
|
||||
"build": "babel src -d dist",
|
||||
"production": "node dist/app.js",
|
||||
"test": "jest",
|
||||
"lint": "eslint --fix ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentiny/tiny-engine-dsl-vue": "^1.0.3",
|
||||
"@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"
|
||||
}
|
||||
}
|
|
@ -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 // 程序崩溃后自动重启
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* 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 { env, port } from '../config/config'
|
||||
import ErrorRoutesCatch from './middleware/ErrorRoutesCatch'
|
||||
import ErrorRoutes from './routes/error-routes'
|
||||
import MainRoutes from './routes/main-routes'
|
||||
|
||||
const app = new Koa2()
|
||||
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
|
|
@ -0,0 +1,3 @@
|
|||
{"id":"L0fyFYECrNiRZMiX","app":{"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}"}}},"name":"我的分类","desc":"","blocks":["ALvDb0JD8atzd3nA"],"category_id":"qukuaifenlei","_id":"L0fyFYECrNiRZMiX"}
|
||||
{"$$indexCreated":{"fieldName":"name","unique":true,"sparse":false}}
|
||||
{"$$indexCreated":{"fieldName":"name","unique":true}}
|
|
@ -0,0 +1,3 @@
|
|||
{"id":"b57MCCORYPGjgL23","app":{"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}"}}},"name":"我的区块","desc":"","blocks":["ALvDb0JD8atzd3nA"],"_id":"b57MCCORYPGjgL23"}
|
||||
{"$$indexCreated":{"fieldName":"name","unique":true,"sparse":false}}
|
||||
{"$$indexCreated":{"fieldName":"name","unique":true}}
|
|
@ -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)
|
||||
})
|
||||
}
|
||||
}
|
|
@ -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}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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 test() {\r\n return 'test'\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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{ "data": [], "locale": "zh-cn" }
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{ "data": [], "locale": "zh-cn" }
|
|
@ -0,0 +1 @@
|
|||
{ "data": [], "locale": "zh-cn" }
|
|
@ -0,0 +1 @@
|
|||
{ "data": [], "locale": "zh-cn" }
|
|
@ -0,0 +1 @@
|
|||
{ "data": [], "locale": "zh-cn" }
|
|
@ -0,0 +1 @@
|
|||
{ "data": [], "locale": "zh-cn" }
|
|
@ -0,0 +1 @@
|
|||
{ "data": [], "locale": "zh-cn" }
|
|
@ -0,0 +1 @@
|
|||
{ "data": [], "locale": "zh-cn" }
|
|
@ -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"
|
||||
}
|
|
@ -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()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,227 @@
|
|||
/**
|
||||
* 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 fs from 'fs-extra'
|
||||
import * as glob from 'glob'
|
||||
import KoaRouter from 'koa-router'
|
||||
import path from 'path'
|
||||
import MockService from '../services/mockService'
|
||||
import { getResponseData } from '../tool/Common'
|
||||
|
||||
const router = new KoaRouter()
|
||||
export const mockService = new MockService()
|
||||
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 mockService.appService.lock(ctx.request.query)
|
||||
})
|
||||
|
||||
router.post('/app-center/api/schema2code', (ctx) => {
|
||||
const { pageInfo } = ctx.request.body
|
||||
ctx.body = mockService.schema2codeService.schema2code(pageInfo)
|
||||
})
|
||||
|
||||
router.get('/app-center/api/preview/metadata', (ctx) => {
|
||||
ctx.body = mockService.appService.getAppPreviewMetaData()
|
||||
})
|
||||
|
||||
router.post('/app-center/api/pages/create', async (ctx) => {
|
||||
ctx.body = await mockService.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 mockService.pageService.update(id, body)
|
||||
})
|
||||
|
||||
router.get('/app-center/api/pages/list/:appId', async (ctx) => {
|
||||
const { appId } = ctx.params
|
||||
ctx.body = await mockService.pageService.list(appId)
|
||||
})
|
||||
|
||||
router.get('/app-center/api/pages/detail/:id', async (ctx) => {
|
||||
const { id } = ctx.params
|
||||
ctx.body = await mockService.pageService.detail(id)
|
||||
})
|
||||
|
||||
router.get('/app-center/api/pages/delete/:id', async (ctx) => {
|
||||
const { id } = ctx.params
|
||||
ctx.body = await mockService.pageService.delete(id)
|
||||
})
|
||||
|
||||
router.get('/material-center/api/block/detail/:id', async (ctx) => {
|
||||
const { id } = ctx.params
|
||||
ctx.body = await mockService.blockService.detail(id)
|
||||
})
|
||||
|
||||
router.get('/material-center/api/blocks', async (ctx) => {
|
||||
const { appId } = ctx.params
|
||||
ctx.body = await mockService.blockService.list(appId)
|
||||
})
|
||||
|
||||
router.post('/material-center/api/block/create', async (ctx) => {
|
||||
const result = mockService.blockService.create(ctx.request.body)
|
||||
const categoriesId = ctx.request.body.categories[0]
|
||||
const _id = result.id
|
||||
await mockService.blockCategoryService.update(categoriesId, { _id })
|
||||
ctx.body = getResponseData(result)
|
||||
})
|
||||
|
||||
router.post('/material-center/api/block/update/:id', async (ctx) => {
|
||||
const { id } = ctx.params
|
||||
const { body } = ctx.request
|
||||
ctx.body = await mockService.blockService.update(id, body)
|
||||
})
|
||||
|
||||
router.get('/material-center/api/block/delete/:id', async (ctx) => {
|
||||
const { id } = ctx.params
|
||||
ctx.body = await mockService.blockService.delete(id)
|
||||
})
|
||||
|
||||
router.post('/material-center/api/block-groups/create', async (ctx) => {
|
||||
ctx.body = await mockService.blockGroupService.create(ctx.request.body)
|
||||
})
|
||||
|
||||
router.post('/material-center/api/block-groups/update/:id', async (ctx) => {
|
||||
const { id } = ctx.params
|
||||
const { body } = ctx.request
|
||||
ctx.body = await mockService.blockGroupService.update(id, body)
|
||||
})
|
||||
|
||||
router.get('/material-center/api/block-groups/delete/:id', async (ctx) => {
|
||||
const { id } = ctx.params
|
||||
ctx.body = await mockService.blockGroupService.delete(id)
|
||||
})
|
||||
|
||||
router.get('/material-center/api/block-groups', async (ctx) => {
|
||||
const result = await mockService.blockGroupService.find(ctx.query)
|
||||
let blockGroup
|
||||
if (result.data.length === 0) {
|
||||
ctx.body = result
|
||||
} else if (result.data.length > 1) {
|
||||
blockGroup = await Promise.all(
|
||||
result.data.map(async (group) => {
|
||||
group.blocks = await Promise.all(
|
||||
group.blocks.map(async (block) => {
|
||||
const blockData = await mockService.blockService.detail(block.id)
|
||||
return blockData
|
||||
})
|
||||
)
|
||||
return group
|
||||
})
|
||||
)
|
||||
ctx.body = getResponseData(blockGroup)
|
||||
} else if (result.data.length === 1) {
|
||||
blockGroup = result.data[0]
|
||||
const blocks = await Promise.all(
|
||||
blockGroup.blocks.map(async (item) => {
|
||||
const blockData = await mockService.blockService.detail(item)
|
||||
return blockData
|
||||
})
|
||||
)
|
||||
|
||||
blockGroup.blocks = blocks
|
||||
ctx.body = getResponseData([blockGroup])
|
||||
}
|
||||
})
|
||||
|
||||
router.post('/material-center/api/block-categories', async (ctx) => {
|
||||
ctx.body = await mockService.blockCategoryService.create(ctx.request.body)
|
||||
})
|
||||
|
||||
router.put('/material-center/api/block-categories/:id', async (ctx) => {
|
||||
const { id } = ctx.params
|
||||
const { body } = ctx.request
|
||||
ctx.body = await mockService.blockCategoryService.update(id, body)
|
||||
})
|
||||
|
||||
router.delete('/material-center/api/block-categories/:id', async (ctx) => {
|
||||
const { id } = ctx.params
|
||||
ctx.body = await mockService.blockCategoryService.delete(id)
|
||||
})
|
||||
|
||||
router.get('/material-center/api/block-categories', async (ctx) => {
|
||||
const result = await mockService.blockCategoryService.find(ctx.query)
|
||||
const blockCategories = await Promise.all(
|
||||
result.data.map(async (group) => {
|
||||
const blocks = await Promise.all(
|
||||
group.blocks.map(async (block) => {
|
||||
const blockData = await mockService.blockService.detail(block)
|
||||
return blockData
|
||||
})
|
||||
)
|
||||
group.blocks = blocks
|
||||
return group
|
||||
})
|
||||
)
|
||||
ctx.body = getResponseData(blockCategories)
|
||||
})
|
||||
|
||||
router.get('/app-center/api/sources/detail/:id', async (ctx) => {
|
||||
const { id } = ctx.params
|
||||
ctx.body = await mockService.sourceService.detail(id)
|
||||
})
|
||||
|
||||
router.post('/material-center/api/block/deploy', async (ctx) => {
|
||||
ctx.body = await mockService.blockBuildService.build(ctx.request.body)
|
||||
})
|
||||
|
||||
router.get('/material-center/api/tasks/:id', async (ctx) => {
|
||||
const { id } = ctx.params
|
||||
ctx.body = await mockService.taskService.detail(id)
|
||||
})
|
||||
|
||||
router.get('/block-history', async (ctx) => {
|
||||
const { id } = ctx.params
|
||||
ctx.body = await mockService.blockHistoryService.find(id)
|
||||
})
|
||||
|
||||
router.post('block-history/create', async (ctx) => {
|
||||
ctx.body = await mockService.blockHistoryService.create(ctx.request.body)
|
||||
})
|
||||
|
||||
export default router
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/**
|
||||
* 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 BlockService {
|
||||
constructor() {
|
||||
this.db = new DateStore({
|
||||
filename: path.resolve(__dirname, '../database/blocks.db'),
|
||||
autoload: true
|
||||
})
|
||||
|
||||
this.db.ensureIndex({
|
||||
fieldName: 'label',
|
||||
unique: true
|
||||
})
|
||||
|
||||
this.userInfo = {
|
||||
id: 86,
|
||||
username: '开发者',
|
||||
email: 'developer@lowcode.com',
|
||||
resetPasswordToken: 'developer',
|
||||
confirmationToken: 'dfb2c162-351f-4f44-ad5f-8998',
|
||||
is_admin: true
|
||||
}
|
||||
|
||||
this.blockModel = {
|
||||
id: '',
|
||||
label: '',
|
||||
name_cn: '',
|
||||
framework: [],
|
||||
content: {},
|
||||
description: '',
|
||||
path: '',
|
||||
screenshot: '',
|
||||
created_app: '',
|
||||
tags: '',
|
||||
categories: [],
|
||||
occupier: {
|
||||
id: 86,
|
||||
username: '开发者',
|
||||
resetPasswordToken: 'developer'
|
||||
},
|
||||
isDefault: null,
|
||||
isOfficial: null
|
||||
}
|
||||
}
|
||||
|
||||
async create(params) {
|
||||
const blockData = { ...this.blockModel, ...params }
|
||||
const result = await this.db.insertAsync(blockData)
|
||||
const { _id } = result
|
||||
await this.db.updateAsync({ _id }, { $set: { id: _id } })
|
||||
result.id = result._id
|
||||
return 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 detail(blockId) {
|
||||
const result = await this.db.findOneAsync({ _id: blockId })
|
||||
return result
|
||||
}
|
||||
|
||||
async delete(blockId) {
|
||||
const result = await this.db.findOneAsync({ _id: blockId })
|
||||
await this.db.removeAsync({ _id: blockId })
|
||||
return getResponseData(result)
|
||||
}
|
||||
|
||||
async list(appId) {
|
||||
const result = await this.db.findAsync()
|
||||
return getResponseData(result)
|
||||
}
|
||||
|
||||
async find(params) {
|
||||
const result = await this.db.findAsync(params)
|
||||
return result
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* 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'
|
||||
import appinfo from './appinfo.json'
|
||||
export default class BlockCategoryService {
|
||||
constructor() {
|
||||
this.db = new DateStore({
|
||||
filename: path.resolve(__dirname, '../database/blockCategories.db'),
|
||||
autoload: true
|
||||
})
|
||||
|
||||
this.db.ensureIndex({
|
||||
fieldName: 'name',
|
||||
unique: true
|
||||
})
|
||||
|
||||
this.blockCategoriesModel = {
|
||||
id: '',
|
||||
app: '',
|
||||
name: '',
|
||||
desc: '',
|
||||
blocks: []
|
||||
}
|
||||
}
|
||||
|
||||
async create(params) {
|
||||
const blockCategoriesData = { ...this.blockCategoriesModel, ...params }
|
||||
blockCategoriesData.app = appinfo.app
|
||||
const result = await this.db.insertAsync(blockCategoriesData)
|
||||
const { _id } = result
|
||||
await this.db.updateAsync({ _id }, { $set: { id: _id } })
|
||||
result.id = result._id
|
||||
return getResponseData(result)
|
||||
}
|
||||
|
||||
async update(id, params) {
|
||||
if (params?._id) {
|
||||
const categories = await this.db.findOneAsync({ _id: id })
|
||||
categories.blocks.push(params._id)
|
||||
await this.db.updateAsync({ _id: id }, { $set: categories })
|
||||
return getResponseData(categories)
|
||||
}
|
||||
params.app = appinfo.app
|
||||
await this.db.updateAsync({ _id: id }, { $set: params })
|
||||
|
||||
const result = await this.db.findOneAsync({ _id: id })
|
||||
return getResponseData(result)
|
||||
}
|
||||
|
||||
async find(params) {
|
||||
const result = await this.db.findAsync()
|
||||
return getResponseData(result)
|
||||
}
|
||||
|
||||
async delete(id) {
|
||||
const result = await this.db.findOneAsync({ _id: id })
|
||||
await this.db.removeAsync({ _id: id })
|
||||
return getResponseData(result)
|
||||
}
|
||||
|
||||
async list(appId) {
|
||||
const result = await this.db.findAsync()
|
||||
return getResponseData(result)
|
||||
}
|
||||
}
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
import path from 'path'
|
||||
import DateStore from '@seald-io/nedb'
|
||||
import { getResponseData } from '../tool/Common'
|
||||
import appinfo from './appinfo.json'
|
||||
export default class BlockGroupService {
|
||||
constructor() {
|
||||
this.db = new DateStore({
|
||||
filename: path.resolve(__dirname, '../database/blockGroups.db'),
|
||||
autoload: true
|
||||
})
|
||||
|
||||
this.db.ensureIndex({
|
||||
fieldName: 'name',
|
||||
unique: true
|
||||
})
|
||||
|
||||
this.blockGroupModel = {
|
||||
id: '',
|
||||
app: '',
|
||||
name: '',
|
||||
desc: '',
|
||||
blocks: []
|
||||
}
|
||||
}
|
||||
|
||||
async create(params) {
|
||||
const blockGroupData = { ...this.blockGroupModel, ...params }
|
||||
blockGroupData.app = appinfo.app
|
||||
const result = await this.db.insertAsync(blockGroupData)
|
||||
const { _id } = result
|
||||
await this.db.updateAsync({ _id }, { $set: { id: _id } })
|
||||
result.id = result._id
|
||||
return getResponseData(result)
|
||||
}
|
||||
|
||||
async update(id, params) {
|
||||
params.app = appinfo.app
|
||||
await this.db.updateAsync({ _id: id }, { $set: params })
|
||||
|
||||
const result = await this.db.findOneAsync({ _id: id })
|
||||
return getResponseData(result)
|
||||
}
|
||||
|
||||
async find(params) {
|
||||
if (params?.app || !params?.id) {
|
||||
const result = await this.db.findAsync()
|
||||
return getResponseData(result)
|
||||
}
|
||||
const { id } = params
|
||||
const blockGroup = await this.db.findOneAsync({ _id: id })
|
||||
return getResponseData([blockGroup])
|
||||
}
|
||||
|
||||
async delete(blockGroupId) {
|
||||
const result = await this.db.findOneAsync({ _id: blockGroupId })
|
||||
await this.db.removeAsync({ _id: blockGroupId })
|
||||
return getResponseData(result)
|
||||
}
|
||||
|
||||
async list(appId) {
|
||||
const result = await this.db.findAsync()
|
||||
return getResponseData(result)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* 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 './pages'
|
||||
import AppService from './app'
|
||||
import BlockService from './block'
|
||||
import SourceService from './source'
|
||||
import BlockGroupService from './blockGroup'
|
||||
import BlockCategoryService from './blockCategory'
|
||||
import Schema2CodeServcice from './schema2code'
|
||||
export default class MockService {
|
||||
schema2codeService
|
||||
pageService
|
||||
appService
|
||||
blockService
|
||||
sourceService
|
||||
blockGroupService
|
||||
blockCategoryService
|
||||
|
||||
constructor() {
|
||||
this.schema2codeService = new Schema2CodeServcice()
|
||||
this.pageService = new PageService()
|
||||
this.appService = new AppService()
|
||||
this.blockService = new BlockService()
|
||||
this.sourceService = new SourceService()
|
||||
this.blockGroupService = new BlockGroupService()
|
||||
this.blockCategoryService = new BlockCategoryService()
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
}
|
||||
}
|