-
Notifications
You must be signed in to change notification settings - Fork 475
feat: add vue to dsl #1785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xuanlid
wants to merge
28
commits into
opentiny:develop
Choose a base branch
from
xuanlid:feat/vue-to-dsl
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: add vue to dsl #1785
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
80c6d65
feat: introduce vue-to-dsl plugin (#1590)
xuanlid c5356d8
test: add tests for data-binding & lifecycles (#1592)
zjy2414 9716ef1
fix: Modify abnormal render
xuanlid 3e78eb1
feat:add upload in toolbars
xuanlid ceb61b2
feat:add upload in toolbars
xuanlid b957f32
fix: create page error
xuanlid 923cffd
fix: create page error
xuanlid fc16b7c
fix: create page error
xuanlid 3cc9e44
feat: add blockSchema
xuanlid 2148a1f
feat: add utils process
xuanlid 896f576
feat: Modify create sequence and file name
xuanlid 836e35f
feat: Modify block schema
xuanlid f303750
feat: JSSlot
xuanlid 9048a95
feat: v-for, v-if / v-else-if / v-else
xuanlid 96793da
feat: generate only the blocks actually used
xuanlid a552cf9
feat: computed
xuanlid 2444418
feat: merge classes
xuanlid f631c7c
feat: #footer/#header/#reference and other slot
xuanlid 9f488bc
feat: state, computed, icon,block processing
xuanlid 952b210
feat: build error
xuanlid 6e2e09b
feat: build error
xuanlid c4f9eaa
feat: image resource, block error
xuanlid db0d4cc
feat: ref
xuanlid c4ddff7
feat: build error
xuanlid 11f34e4
feat: add import reminder
xuanlid 562ddb5
feat: routeLink and routeView
xuanlid f89f855
feat: dynamically obtaining material
xuanlid 55a1c78
fix: Modify review
xuanlid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,7 @@ const getDevAlias = (useSourceAlias) => { | |
| '@opentiny/tiny-engine-toolbar-media': path.resolve(basePath, 'packages/toolbars/media/index.ts'), | ||
| '@opentiny/tiny-engine-toolbar-preview': path.resolve(basePath, 'packages/toolbars/preview/index.ts'), | ||
| '@opentiny/tiny-engine-toolbar-generate-code': path.resolve(basePath, 'packages/toolbars/generate-code/index.ts'), | ||
| '@opentiny/tiny-engine-toolbar-upload': path.resolve(basePath, 'packages/toolbars/upload/index.ts'), | ||
| '@opentiny/tiny-engine-toolbar-refresh': path.resolve(basePath, 'packages/toolbars/refresh/index.ts'), | ||
| '@opentiny/tiny-engine-toolbar-redoundo': path.resolve(basePath, 'packages/toolbars/redoundo/index.ts'), | ||
| '@opentiny/tiny-engine-toolbar-clean': path.resolve(basePath, 'packages/toolbars/clean/index.ts'), | ||
|
|
@@ -70,7 +71,8 @@ const getDevAlias = (useSourceAlias) => { | |
| '@opentiny/tiny-engine-workspace-template-center': path.resolve( | ||
| basePath, | ||
| 'packages/workspace/template-center/index.ts' | ||
| ) | ||
| ), | ||
| '@opentiny/tiny-engine-vue-to-dsl': path.resolve(basePath, 'packages/vue-to-dsl/src/index.ts') | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 每次上传新的项目都会把上一个项目的应用状态覆盖掉 |
||
| } | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /** | ||
| * Copyright (c) 2023 - present TinyEngine Authors. | ||
| * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license. | ||
| * | ||
| * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, | ||
| * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR | ||
| * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. | ||
| * | ||
| */ | ||
|
|
||
| import entry from './src/Main.vue' | ||
| import metaData from './meta' | ||
| import './src/styles/vars.less' | ||
|
|
||
| export default { | ||
| ...metaData, | ||
| entry | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| export default { | ||
| id: 'engine.toolbars.upload', | ||
| type: 'toolbars', | ||
| title: 'upload', | ||
| options: { | ||
| icon: { | ||
| default: 'upload' | ||
| }, | ||
| renderType: 'button' | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| { | ||
| "name": "@opentiny/tiny-engine-toolbar-upload", | ||
| "version": "2.10.0", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "scripts": { | ||
| "build": "vite build" | ||
| }, | ||
| "type": "module", | ||
| "main": "dist/index.js", | ||
| "module": "dist/index.js", | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/opentiny/tiny-engine", | ||
| "directory": "packages/toolbars/upload" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/opentiny/tiny-engine/issues" | ||
| }, | ||
| "author": "OpenTiny Team", | ||
| "license": "MIT", | ||
| "homepage": "https://opentiny.design/tiny-engine", | ||
| "dependencies": { | ||
| "@babel/parser": "^7.23.0", | ||
| "@opentiny/tiny-engine-common": "workspace:*", | ||
| "@opentiny/tiny-engine-meta-register": "workspace:*", | ||
| "@opentiny/tiny-engine-utils": "workspace:*", | ||
| "@opentiny/tiny-engine-vue-to-dsl": "workspace:*" | ||
| }, | ||
| "devDependencies": { | ||
| "@opentiny/tiny-engine-vite-plugin-meta-comments": "workspace:*", | ||
| "@vitejs/plugin-vue": "^5.1.2", | ||
| "@vitejs/plugin-vue-jsx": "^4.0.1", | ||
| "vite": "^5.4.2" | ||
| }, | ||
| "peerDependencies": { | ||
| "@opentiny/vue": "^3.20.0", | ||
| "@opentiny/vue-icon": "^3.20.0", | ||
| "vue": "^3.4.15" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| <template> | ||
| <tiny-dialog-box | ||
| class="import-notice-dialog" | ||
| :visible="visible" | ||
| :append-to-body="true" | ||
| :modal="true" | ||
| :lock-scroll="true" | ||
| width="560px" | ||
| :title="dialogTitle" | ||
| @update:visible="onUpdateVisible" | ||
| > | ||
| <div class="summary">{{ summaryText }}</div> | ||
| <div class="section"> | ||
| <div class="section-title">重点说明</div> | ||
| <ul class="notice-list"> | ||
| <li class="notice-item" v-for="item in noticeItems" :key="item"> | ||
| {{ item }} | ||
| </li> | ||
| </ul> | ||
| </div> | ||
| <template #footer> | ||
| <tiny-button type="primary" @click="emitConfirm">继续导入</tiny-button> | ||
| <tiny-button @click="emitCancel">取消</tiny-button> | ||
| </template> | ||
| </tiny-dialog-box> | ||
| </template> | ||
|
|
||
| <script lang="ts"> | ||
| import { computed, defineComponent } from 'vue' | ||
| import { DialogBox, Button } from '@opentiny/vue' | ||
|
|
||
| export default defineComponent({ | ||
| name: 'ImportNoticeDialog', | ||
| components: { | ||
| TinyDialogBox: DialogBox as any, | ||
| TinyButton: Button as any | ||
| }, | ||
| props: { | ||
| visible: { type: Boolean, default: false }, | ||
| uploadType: { type: String, default: 'directory' } | ||
| }, | ||
| emits: ['confirm', 'cancel', 'update:visible'], | ||
| setup(props, { emit }) { | ||
| const importModeLabel = computed(() => (props.uploadType === 'zip' ? '项目压缩包' : '项目目录')) | ||
| const dialogTitle = computed(() => `导入${importModeLabel.value}提醒`) | ||
| const summaryText = computed(() => | ||
| props.uploadType === 'zip' | ||
| ? '导入项目压缩包前,请确认压缩包内直接包含项目根结构,而不是只压缩 src 目录。若目录结构不符合约定,部分页面或配置会被跳过。' | ||
| : '导入项目目录前,请确认你选择的是项目根目录,而不是 src 或其他子目录。若目录结构不符合约定,部分页面或配置会被跳过。' | ||
| ) | ||
| const noticeItems = computed(() => { | ||
| const modeSpecificItems = | ||
| props.uploadType === 'zip' | ||
| ? [ | ||
| '压缩包内应直接包含 src、public、package.json 等项目根文件,不建议只打包 src 目录。', | ||
| '若压缩包里额外套了多层无关目录,固定路径可能匹配失败,导致页面、路由或资源识别不完整。' | ||
| ] | ||
| : [ | ||
| '请选择项目根目录,不要只选 src、views 或其他子目录。', | ||
| '目录上传会按所选目录作为根路径解析;如果根目录选错,固定路径文件可能全部识别不到。' | ||
| ] | ||
|
|
||
| return [ | ||
| ...modeSpecificItems, | ||
| '页面只会读取 src/views/**/*.vue,其他目录下的页面文件不会直接导入。', | ||
| '页面里实际使用到的本地 .vue 子组件会转成区块,未使用的组件不会导入。', | ||
| '路由、国际化、数据源、全局状态仅识别固定路径,如 src/router/index.js、src/i18n、src/lowcodeConfig/dataSource.json、src/stores/*.js。', | ||
| '本地图片仅支持静态本地路径引用,远程地址和运行时拼接路径不会自动导入。', | ||
| '若未识别到 src/views 页面,将不会创建页面,只会尽量导入全局配置、资源或区块。' | ||
| ] | ||
| }) | ||
|
|
||
| const emitConfirm = () => { | ||
| emit('update:visible', false) | ||
| emit('confirm') | ||
| } | ||
|
|
||
| const emitCancel = () => { | ||
| emit('update:visible', false) | ||
| emit('cancel') | ||
| } | ||
|
|
||
| const onUpdateVisible = (value: boolean) => emit('update:visible', value) | ||
|
|
||
| return { | ||
| importModeLabel, | ||
| dialogTitle, | ||
| summaryText, | ||
| noticeItems, | ||
| emitConfirm, | ||
| emitCancel, | ||
| onUpdateVisible | ||
| } | ||
| } | ||
| }) | ||
| </script> | ||
|
|
||
| <style lang="less" scoped> | ||
| .import-notice-dialog { | ||
| .summary { | ||
| font-size: 12px; | ||
| line-height: 20px; | ||
| color: var(--te-toolbars-upload-text-color-primary); | ||
| margin-bottom: 12px; | ||
| } | ||
|
|
||
| .section { | ||
| padding: 12px; | ||
| border-radius: 8px; | ||
| background: var(--te-toolbars-upload-bg-color); | ||
| } | ||
|
|
||
| .section-title { | ||
| margin-bottom: 8px; | ||
| font-size: 12px; | ||
| font-weight: 600; | ||
| color: var(--te-toolbars-upload-text-color-primary); | ||
| } | ||
|
|
||
| .notice-list { | ||
| margin: 0; | ||
| padding: 0; | ||
| list-style: none; | ||
| color: var(--te-toolbars-upload-text-color-secondary); | ||
| font-size: 12px; | ||
| line-height: 20px; | ||
| } | ||
|
|
||
| .notice-item { | ||
| position: relative; | ||
| padding-left: 16px; | ||
| display: flex; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .notice-item + .notice-item { | ||
| margin-top: 8px; | ||
| padding-top: 8px; | ||
| } | ||
|
|
||
| .notice-item::before { | ||
| content: ''; | ||
| position: absolute; | ||
| left: 0; | ||
| width: 6px; | ||
| height: 6px; | ||
| border-radius: 50%; | ||
| background: var(--te-toolbars-upload-icon-color-primary); | ||
| } | ||
|
|
||
| code { | ||
| padding: 0 4px; | ||
| border-radius: 4px; | ||
| color: var(--te-toolbars-upload-text-color-primary); | ||
| background: var(--te-toolbars-upload-bg-color-primary); | ||
| } | ||
| } | ||
| </style> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
导入区块后,页面区块显示报错
