Skip to content

Commit 60472e0

Browse files
xuanlidzjy2414
andauthored
feat: add vue to dsl (#1785)
* feat: introduce vue-to-dsl plugin (#1590) * test: add tests for data-binding & lifecycles (#1592) * fix: Modify abnormal render * feat:add upload in toolbars * feat:add upload in toolbars * fix: create page error * fix: create page error * fix: create page error * feat: add blockSchema * feat: add utils process * feat: Modify create sequence and file name * feat: Modify block schema * feat: JSSlot * feat: v-for, v-if / v-else-if / v-else * feat: generate only the blocks actually used * feat: computed * feat: merge classes * feat: #footer/#header/#reference and other slot * feat: state, computed, icon,block processing * feat: build error * feat: build error * feat: image resource, block error * feat: ref * feat: build error * feat: add import reminder * feat: routeLink and routeView * feat: dynamically obtaining material * fix: Modify review * fix: block import error, application status merged * fix: 应用状态 * fix: gh-page * fix: datasource * fix: gh-page * fix: i18n flattening * fix: i18n * fix: gh-pages * fix: gh-pages --------- Co-authored-by: 东南dnf <zjy2414@outlook.com>
1 parent 8a5634c commit 60472e0

86 files changed

Lines changed: 20973 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/build/vite-config/src/vite-plugins/devAliasPlugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const getDevAlias = (useSourceAlias) => {
4444
'@opentiny/tiny-engine-toolbar-media': path.resolve(basePath, 'packages/toolbars/media/index.ts'),
4545
'@opentiny/tiny-engine-toolbar-preview': path.resolve(basePath, 'packages/toolbars/preview/index.ts'),
4646
'@opentiny/tiny-engine-toolbar-generate-code': path.resolve(basePath, 'packages/toolbars/generate-code/index.ts'),
47+
'@opentiny/tiny-engine-toolbar-upload': path.resolve(basePath, 'packages/toolbars/upload/index.ts'),
4748
'@opentiny/tiny-engine-toolbar-refresh': path.resolve(basePath, 'packages/toolbars/refresh/index.ts'),
4849
'@opentiny/tiny-engine-toolbar-redoundo': path.resolve(basePath, 'packages/toolbars/redoundo/index.ts'),
4950
'@opentiny/tiny-engine-toolbar-clean': path.resolve(basePath, 'packages/toolbars/clean/index.ts'),
@@ -70,7 +71,8 @@ const getDevAlias = (useSourceAlias) => {
7071
'@opentiny/tiny-engine-workspace-template-center': path.resolve(
7172
basePath,
7273
'packages/workspace/template-center/index.ts'
73-
)
74+
),
75+
'@opentiny/tiny-engine-vue-to-dsl': path.resolve(basePath, 'packages/vue-to-dsl/src/index.ts')
7476
}
7577
}
7678

packages/design-core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"@opentiny/tiny-engine-toolbar-collaboration": "workspace:*",
7777
"@opentiny/tiny-engine-toolbar-fullscreen": "workspace:*",
7878
"@opentiny/tiny-engine-toolbar-generate-code": "workspace:*",
79+
"@opentiny/tiny-engine-toolbar-upload": "workspace:*",
7980
"@opentiny/tiny-engine-toolbar-lang": "workspace:*",
8081
"@opentiny/tiny-engine-toolbar-lock": "workspace:*",
8182
"@opentiny/tiny-engine-toolbar-logo": "workspace:*",

packages/design-core/re-export.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export { default as Clean } from '@opentiny/tiny-engine-toolbar-clean'
1212
export { default as ThemeSwitch, ThemeSwitchService } from '@opentiny/tiny-engine-toolbar-theme-switch'
1313
export { default as Preview } from '@opentiny/tiny-engine-toolbar-preview'
1414
export { default as GenerateCode, SaveLocalService } from '@opentiny/tiny-engine-toolbar-generate-code'
15+
export { default as Upload } from '@opentiny/tiny-engine-toolbar-upload'
1516
export { default as Refresh } from '@opentiny/tiny-engine-toolbar-refresh'
1617
export { default as Collaboration } from '@opentiny/tiny-engine-toolbar-collaboration'
1718
export { default as Setting } from '@opentiny/tiny-engine-toolbar-setting'

packages/design-core/registry.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
ThemeSwitch,
2727
Preview,
2828
GenerateCode,
29+
Upload,
2930
Refresh,
3031
Collaboration,
3132
Materials,
@@ -153,6 +154,7 @@ export default {
153154
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.preview'] === false ? null : Preview,
154155
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.refresh'] === false ? null : Refresh,
155156
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.generate-code'] === false ? null : GenerateCode,
157+
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.upload'] === false ? null : Upload,
156158
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.save'] === false ? null : Save,
157159
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.fullscreen'] === false ? null : Fullscreen,
158160
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.lang'] === false ? null : Lang,

packages/layout/src/defaultLayout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default {
2828
right: [
2929
[META_APP.Robot, META_APP.ThemeSwitch, META_APP.RedoUndo, META_APP.Clean],
3030
[META_APP.Preview],
31-
[META_APP.GenerateCode, META_APP.Save]
31+
[META_APP.Upload, META_APP.GenerateCode, META_APP.Save]
3232
],
3333
collapse: [
3434
[META_APP.Collaboration],

packages/register/src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const META_APP = {
4141
Refresh: 'engine.toolbars.refresh',
4242
Save: 'engine.toolbars.save',
4343
GenerateCode: 'engine.toolbars.generate-code',
44+
Upload: 'engine.toolbars.upload',
4445
Preview: 'engine.toolbars.preview',
4546
RedoUndo: 'engine.toolbars.redoundo',
4647
Fullscreen: 'engine.toolbars.fullscreen',

packages/toolbars/upload/index.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Copyright (c) 2023 - present TinyEngine Authors.
3+
* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
4+
*
5+
* Use of this source code is governed by an MIT-style license.
6+
*
7+
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8+
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9+
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10+
*
11+
*/
12+
13+
import entry from './src/Main.vue'
14+
import metaData from './meta'
15+
import './src/styles/vars.less'
16+
17+
export default {
18+
...metaData,
19+
entry
20+
}

packages/toolbars/upload/meta.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
id: 'engine.toolbars.upload',
3+
type: 'toolbars',
4+
title: 'upload',
5+
options: {
6+
icon: {
7+
default: 'upload'
8+
},
9+
renderType: 'button'
10+
}
11+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "@opentiny/tiny-engine-toolbar-upload",
3+
"version": "2.10.0",
4+
"publishConfig": {
5+
"access": "public"
6+
},
7+
"scripts": {
8+
"build": "vite build"
9+
},
10+
"type": "module",
11+
"main": "dist/index.js",
12+
"module": "dist/index.js",
13+
"files": [
14+
"dist"
15+
],
16+
"repository": {
17+
"type": "git",
18+
"url": "https://github.com/opentiny/tiny-engine",
19+
"directory": "packages/toolbars/upload"
20+
},
21+
"bugs": {
22+
"url": "https://github.com/opentiny/tiny-engine/issues"
23+
},
24+
"author": "OpenTiny Team",
25+
"license": "MIT",
26+
"homepage": "https://opentiny.design/tiny-engine",
27+
"dependencies": {
28+
"@babel/parser": "^7.23.0",
29+
"@opentiny/tiny-engine-common": "workspace:*",
30+
"@opentiny/tiny-engine-meta-register": "workspace:*",
31+
"@opentiny/tiny-engine-utils": "workspace:*",
32+
"@opentiny/tiny-engine-vue-to-dsl": "workspace:*"
33+
},
34+
"devDependencies": {
35+
"@opentiny/tiny-engine-vite-plugin-meta-comments": "workspace:*",
36+
"@vitejs/plugin-vue": "^5.1.2",
37+
"@vitejs/plugin-vue-jsx": "^4.0.1",
38+
"vite": "^5.4.2"
39+
},
40+
"peerDependencies": {
41+
"@opentiny/vue": "^3.20.0",
42+
"@opentiny/vue-icon": "^3.20.0",
43+
"vue": "^3.4.15"
44+
}
45+
}
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
<template>
2+
<tiny-dialog-box
3+
class="import-notice-dialog"
4+
:visible="visible"
5+
:append-to-body="true"
6+
:modal="true"
7+
:lock-scroll="true"
8+
width="560px"
9+
:title="dialogTitle"
10+
@update:visible="onUpdateVisible"
11+
>
12+
<div class="summary">{{ summaryText }}</div>
13+
<div class="section">
14+
<div class="section-title">重点说明</div>
15+
<ul class="notice-list">
16+
<li class="notice-item" v-for="item in noticeItems" :key="item">
17+
{{ item }}
18+
</li>
19+
</ul>
20+
</div>
21+
<template #footer>
22+
<tiny-button type="primary" @click="emitConfirm">继续导入</tiny-button>
23+
<tiny-button @click="emitCancel">取消</tiny-button>
24+
</template>
25+
</tiny-dialog-box>
26+
</template>
27+
28+
<script lang="ts">
29+
import { computed, defineComponent } from 'vue'
30+
import { DialogBox, Button } from '@opentiny/vue'
31+
32+
export default defineComponent({
33+
name: 'ImportNoticeDialog',
34+
components: {
35+
TinyDialogBox: DialogBox as any,
36+
TinyButton: Button as any
37+
},
38+
props: {
39+
visible: { type: Boolean, default: false },
40+
uploadType: { type: String, default: 'directory' }
41+
},
42+
emits: ['confirm', 'cancel', 'update:visible'],
43+
setup(props, { emit }) {
44+
const importModeLabel = computed(() => (props.uploadType === 'zip' ? '项目压缩包' : '项目目录'))
45+
const dialogTitle = computed(() => `导入${importModeLabel.value}提醒`)
46+
const summaryText = computed(() =>
47+
props.uploadType === 'zip'
48+
? '导入项目压缩包前,请确认压缩包内直接包含项目根结构,而不是只压缩 src 目录。若目录结构不符合约定,部分页面或配置会被跳过。'
49+
: '导入项目目录前,请确认你选择的是项目根目录,而不是 src 或其他子目录。若目录结构不符合约定,部分页面或配置会被跳过。'
50+
)
51+
const noticeItems = computed(() => {
52+
const modeSpecificItems =
53+
props.uploadType === 'zip'
54+
? [
55+
'压缩包内应直接包含 src、public、package.json 等项目根文件,不建议只打包 src 目录。',
56+
'若压缩包里额外套了多层无关目录,固定路径可能匹配失败,导致页面、路由或资源识别不完整。'
57+
]
58+
: [
59+
'请选择项目根目录,不要只选 src、views 或其他子目录。',
60+
'目录上传会按所选目录作为根路径解析;如果根目录选错,固定路径文件可能全部识别不到。'
61+
]
62+
63+
return [
64+
...modeSpecificItems,
65+
'页面只会读取 src/views/**/*.vue,其他目录下的页面文件不会直接导入。',
66+
'页面里实际使用到的本地 .vue 子组件会转成区块,未使用的组件不会导入。',
67+
'路由、国际化、数据源、全局状态仅识别固定路径,如 src/router/index.js、src/i18n、src/lowcodeConfig/dataSource.json、src/stores/*.js。',
68+
'本地图片仅支持静态本地路径引用,远程地址和运行时拼接路径不会自动导入。',
69+
'若未识别到 src/views 页面,将不会创建页面,只会尽量导入全局配置、资源或区块。'
70+
]
71+
})
72+
73+
const emitConfirm = () => {
74+
emit('update:visible', false)
75+
emit('confirm')
76+
}
77+
78+
const emitCancel = () => {
79+
emit('update:visible', false)
80+
emit('cancel')
81+
}
82+
83+
const onUpdateVisible = (value: boolean) => emit('update:visible', value)
84+
85+
return {
86+
importModeLabel,
87+
dialogTitle,
88+
summaryText,
89+
noticeItems,
90+
emitConfirm,
91+
emitCancel,
92+
onUpdateVisible
93+
}
94+
}
95+
})
96+
</script>
97+
98+
<style lang="less" scoped>
99+
.import-notice-dialog {
100+
.summary {
101+
font-size: 12px;
102+
line-height: 20px;
103+
color: var(--te-toolbars-upload-text-color-primary);
104+
margin-bottom: 12px;
105+
}
106+
107+
.section {
108+
padding: 12px;
109+
border-radius: 8px;
110+
background: var(--te-toolbars-upload-bg-color);
111+
}
112+
113+
.section-title {
114+
margin-bottom: 8px;
115+
font-size: 12px;
116+
font-weight: 600;
117+
color: var(--te-toolbars-upload-text-color-primary);
118+
}
119+
120+
.notice-list {
121+
margin: 0;
122+
padding: 0;
123+
list-style: none;
124+
color: var(--te-toolbars-upload-text-color-secondary);
125+
font-size: 12px;
126+
line-height: 20px;
127+
}
128+
129+
.notice-item {
130+
position: relative;
131+
padding-left: 16px;
132+
display: flex;
133+
align-items: center;
134+
}
135+
136+
.notice-item + .notice-item {
137+
margin-top: 8px;
138+
padding-top: 8px;
139+
}
140+
141+
.notice-item::before {
142+
content: '';
143+
position: absolute;
144+
left: 0;
145+
width: 6px;
146+
height: 6px;
147+
border-radius: 50%;
148+
background: var(--te-toolbars-upload-icon-color-primary);
149+
}
150+
151+
code {
152+
padding: 0 4px;
153+
border-radius: 4px;
154+
color: var(--te-toolbars-upload-text-color-primary);
155+
background: var(--te-toolbars-upload-bg-color-primary);
156+
}
157+
}
158+
</style>

0 commit comments

Comments
 (0)