Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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')
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/design-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"@opentiny/tiny-engine-toolbar-collaboration": "workspace:*",
"@opentiny/tiny-engine-toolbar-fullscreen": "workspace:*",
"@opentiny/tiny-engine-toolbar-generate-code": "workspace:*",
"@opentiny/tiny-engine-toolbar-upload": "workspace:*",
"@opentiny/tiny-engine-toolbar-lang": "workspace:*",
"@opentiny/tiny-engine-toolbar-lock": "workspace:*",
"@opentiny/tiny-engine-toolbar-logo": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions packages/design-core/re-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export { default as Clean } from '@opentiny/tiny-engine-toolbar-clean'
export { default as ThemeSwitch, ThemeSwitchService } from '@opentiny/tiny-engine-toolbar-theme-switch'
export { default as Preview } from '@opentiny/tiny-engine-toolbar-preview'
export { default as GenerateCode, SaveLocalService } from '@opentiny/tiny-engine-toolbar-generate-code'
export { default as Upload } from '@opentiny/tiny-engine-toolbar-upload'
export { default as Refresh } from '@opentiny/tiny-engine-toolbar-refresh'
export { default as Collaboration } from '@opentiny/tiny-engine-toolbar-collaboration'
export { default as Setting } from '@opentiny/tiny-engine-toolbar-setting'
Expand Down
2 changes: 2 additions & 0 deletions packages/design-core/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
ThemeSwitch,
Preview,
GenerateCode,
Upload,
Refresh,
Collaboration,
Materials,
Expand Down Expand Up @@ -153,6 +154,7 @@ export default {
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.preview'] === false ? null : Preview,
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.refresh'] === false ? null : Refresh,
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.generate-code'] === false ? null : GenerateCode,
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.upload'] === false ? null : Upload,
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.save'] === false ? null : Save,
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.fullscreen'] === false ? null : Fullscreen,
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.lang'] === false ? null : Lang,
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/src/defaultLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
right: [
[META_APP.Robot, META_APP.ThemeSwitch, META_APP.RedoUndo, META_APP.Clean],
[META_APP.Preview],
[META_APP.GenerateCode, META_APP.Save]
[META_APP.Upload, META_APP.GenerateCode, META_APP.Save]
],
collapse: [
[META_APP.Collaboration],
Expand Down
1 change: 1 addition & 0 deletions packages/register/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const META_APP = {
Refresh: 'engine.toolbars.refresh',
Save: 'engine.toolbars.save',
GenerateCode: 'engine.toolbars.generate-code',
Upload: 'engine.toolbars.upload',
Preview: 'engine.toolbars.preview',
RedoUndo: 'engine.toolbars.redoundo',
Fullscreen: 'engine.toolbars.fullscreen',
Expand Down
20 changes: 20 additions & 0 deletions packages/toolbars/upload/index.ts
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
}
11 changes: 11 additions & 0 deletions packages/toolbars/upload/meta.js
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'
}
}
45 changes: 45 additions & 0 deletions packages/toolbars/upload/package.json
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"
}
}
158 changes: 158 additions & 0 deletions packages/toolbars/upload/src/ImportNoticeDialog.vue
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>
Loading
Loading