Skip to content

Commit

Permalink
Merge branch 'refactor/develop' of github.com:opentiny/tiny-engine in…
Browse files Browse the repository at this point in the history
…to feat/http-customized-interceptor
  • Loading branch information
yy-wow committed Oct 28, 2024
2 parents a6effe0 + 48687e8 commit 1b852c2
Show file tree
Hide file tree
Showing 341 changed files with 3,972 additions and 2,732 deletions.
2 changes: 1 addition & 1 deletion designer-demo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "designer-demo",
"private": true,
"version": "2.0.0-alpha.3",
"version": "2.0.0-alpha.5",
"type": "module",
"scripts": {
"dev": "cross-env VITE_THEME=light vite",
Expand Down
7 changes: 3 additions & 4 deletions designer-demo/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,15 @@ import {
Styles,
Layout,
Canvas,
EditorInfoService,
AppService,
GenerateCodeService
GenerateCodeService,
GlobalService
} from '@opentiny/tiny-engine'
import engineConfig from './engine.config'

export default {
root: {
id: 'engine.root',
metas: [EditorInfoService, AppService, GenerateCodeService]
metas: [GenerateCodeService, GlobalService]
},
config: engineConfig,
layout: {
Expand Down
6 changes: 5 additions & 1 deletion designer-demo/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ import { configurators } from './configurators/'
import 'virtual:svg-icons-register'
import '@opentiny/tiny-engine-theme'

init({ registry, configurators })
init({
registry,
configurators,
createAppSignal: ['global_service_init_finish']
})
3 changes: 1 addition & 2 deletions mockServer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-mock",
"version": "2.0.0-alpha.3",
"version": "2.0.0-alpha.5",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -32,7 +32,6 @@
},
"dependencies": {
"@babel/runtime": "^7.9.2",
"@opentiny/tiny-engine-dsl-vue": "^2.0.0-alpha.3",
"@seald-io/nedb": "^4.0.2",
"fs-extra": "^11.1.1",
"glob": "^10.3.4",
Expand Down
99 changes: 2 additions & 97 deletions mockServer/src/services/schema2code.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,104 +10,9 @@
*
*/

import { pageService } from '../routes/main-routes'
import appInfo from '../assets/json/appinfo.json'

export default class Schema2CodeServcice {
constructor() {
this.blockHistories = appInfo.blockHistories
this.components = appInfo.materialHistory.components
}

constructor() {}
schema2code(pageInfo, type = 'page') {
const { schema, name } = pageInfo
return this.translateSchema({
schema,
name,
type
})
}

/**
* 通过dsl 将页面/区块schema数据生成对应代码
* @param { I_TranslateSchemaParam } params
* @return {Promise<I_Response>} dsl函数返回数据
*/
translateSchema(params) {
const { schema, name, type, blockHistories = this.blockHistories, components = this.components } = params
// 页面/区块 预览只需将页面、区块路径和区块构建产物路径统一设置为 ./components 即可
const defaultMain = './components'
let componentsMap = this.getComponentSchema(components)
componentsMap = componentsMap.concat(this.getBlockSchema(blockHistories))
componentsMap.forEach((component) => {
if (component.main !== undefined) {
component.main = defaultMain
}
})

componentsMap.push({
componentName: name,
main: defaultMain
})

const { generateCode } = require('@opentiny/tiny-engine-dsl-vue')
let code
try {
code = generateCode({
pageInfo: { schema, name },
blocksData: [],
componentsMap
})
} catch (e) {
this.getResponseData(null, e)
}

return this.getResponseData(code)
}

getResponseData(data, error) {
const res = {
data
}

if (error) {
const err_code = error.code || ''
res.error = {
code: err_code,
message: error.message || ''
}
}
return res
}

getComponentSchema(components) {
return components.map((component) => {
const {
component: componentName,
npm: { package: packageName, exportName, version, destructuring } = {}
} = component
return {
componentName,
package: packageName,
exportName,
destructuring,
version
}
})
}

// 将区块组装成schema数据
getBlockSchema(blockHistories) {
return blockHistories.map((blockHistory) => {
const { path, version } = blockHistory
// 每个区块历史记录必有content
const { fileName: componentName } = blockHistory.content
return {
componentName,
main: path || '',
destructuring: false,
version: version || 'N/A'
}
})
return { data: null, code: 410, message: 'deprecated api, please use `@opentiny/tiny-engine-dsl-vue` directly.' }
}
}
2 changes: 1 addition & 1 deletion packages/blockToWebComponentTemplate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-block-build",
"version": "2.0.0-alpha.3",
"version": "2.0.0-alpha.5",
"description": "translate block to webcomponent template",
"main": "./dist/web-components.es.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/build/vite-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-vite-config",
"version": "2.0.0-alpha.3",
"version": "2.0.0-alpha.5",
"description": "",
"type": "module",
"main": "./index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/build/vite-plugin-meta-comments/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-vite-plugin-meta-comments",
"version": "2.0.0-alpha.3",
"version": "2.0.0-alpha.5",
"description": "",
"type": "module",
"main": "dist/index.cjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/builtinComponent/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-builtin-component",
"version": "2.0.0-alpha.3",
"version": "2.0.0-alpha.5",
"description": "",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/canvas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-canvas",
"version": "2.0.0-alpha.3",
"version": "2.0.0-alpha.5",
"publishConfig": {
"access": "public"
},
Expand Down
14 changes: 9 additions & 5 deletions packages/common/component/BindI18n.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,10 @@ export default {
<style lang="less" scoped>
.languageContent {
width: 254px;
border-radius: 5px;
text-align: center;
z-index: 99;
margin-top: 5px;
margin-bottom: 16px;
.tiny-svg {
margin-right: 10px;
Expand All @@ -184,7 +183,6 @@ export default {
}
}
.tiny-button {
margin-top: 10px;
max-width: initial;
padding: 0 12px;
background-color: var(--ti-lowcode-tabs-border-color);
Expand All @@ -196,18 +194,24 @@ export default {
}
}
.addNewLanguage {
padding: 0px 5px 5px;
.tiny-input {
display: flex;
margin-bottom: 10px;
padding: 0 8px;
align-items: center;
label {
width: 80px;
text-wrap: nowrap;
text-align: left;
width: 50px;
}
display: flex;
}
.tiny-input__inner {
flex: 1;
}
.add-btns {
text-align: right;
padding: 0 8px;
}
}
}
Expand Down
32 changes: 23 additions & 9 deletions packages/common/component/BlockDescription.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<template>
<meta-description class="description" type="warning">
<meta-description class="description">
<template #content>
<div @click="openBlockSetting" class="setting-block"><span class="add-icon">+</span>设置区块暴露属性</div>
<div class="setting-block" @click="openBlockSetting">
<svg-icon name="block-add-prop"></svg-icon>
<span>设置区块暴露属性</span>
</div>
</template>
</meta-description>
</template>
Expand Down Expand Up @@ -33,17 +36,28 @@ export default {

<style lang="less" scoped>
.description {
border-color: var(--ti-lowcode-description-color);
font-size: 12px;
&.wrapper {
height: 32px;
padding: 0 12px;
border-left: 0;
box-shadow: none;
border-radius: 4px;
display: flex;
align-items: center;
background-color: var(--te-common-bg-container);
}
.setting-block {
display: flex;
align-items: center;
gap: 4px;
cursor: pointer;
}
.add-icon {
padding: 0 3px;
margin: 0 5px;
color: var(--ti-lowcode-toolbar-icon-color);
border-radius: 50%;
background-color: var(--ti-lowcode-description-color);
.svg-icon {
font-size: 16px;
}
}
</style>
1 change: 0 additions & 1 deletion packages/common/component/BlockHistoryList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ defineEmits(['preview', 'restore'])
}
.empty {
margin-left: 12px;
color: var(--ti-lowcode-common-empty-text-color);
}
</style>
Loading

0 comments on commit 1b852c2

Please sign in to comment.