Skip to content

Commit

Permalink
Merge branch 'refactor/develop' into refactor/split-renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
yy-wow committed Nov 13, 2024
2 parents 0097246 + 67330d4 commit af1dc68
Show file tree
Hide file tree
Showing 64 changed files with 173 additions and 91 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-rc.1",
"version": "2.0.0-rc.2",
"type": "module",
"scripts": {
"dev": "cross-env VITE_THEME=light vite",
Expand Down
2 changes: 1 addition & 1 deletion 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-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
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-rc.1",
"version": "2.0.0-rc.2",
"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-rc.1",
"version": "2.0.0-rc.2",
"description": "",
"type": "module",
"main": "./index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ const getDevAlias = (useSourceAlias) => {
'@opentiny/tiny-engine-theme-light': path.resolve(basePath, 'packages/theme/light/index.less'),
'@opentiny/tiny-engine-theme-base': path.resolve(basePath, 'packages/theme/base/src/index.js'),
'@opentiny/tiny-engine-svgs': path.resolve(basePath, 'packages/svgs/index.js'),
'@opentiny/tiny-engine-canvas': path.resolve(basePath, 'packages/canvas/index.js'),
'@opentiny/tiny-engine-canvas/render': path.resolve(basePath, 'packages/canvas/render/index.js'),
'@opentiny/tiny-engine-canvas': path.resolve(basePath, 'packages/canvas/index.js'),
'@opentiny/tiny-engine-renderer': path.resolve(basePath, 'packages/renderer/src/index.js'),
'@opentiny/tiny-engine-utils': path.resolve(basePath, 'packages/utils/src/index.js'),
'@opentiny/tiny-engine-webcomponent-core': path.resolve(basePath, 'packages/webcomponent/src/lib.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-rc.1",
"version": "2.0.0-rc.2",
"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-rc.1",
"version": "2.0.0-rc.2",
"description": "",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/canvas/common/src/constant.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
export const NODE_UID = 'data-uid'
export const NODE_TAG = 'data-tag'
export const NODE_LOOP = 'loop-id'

export const DESIGN_MODE = {
DESIGN: 'design', // 设计态
RUNTIME: 'runtime' // 运行态
}
36 changes: 25 additions & 11 deletions packages/canvas/container/src/CanvasContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import { onMounted, ref, computed, onUnmounted } from 'vue'
import { iframeMonitoring } from '@opentiny/tiny-engine-common/js/monitor'
import { useTranslate, useCanvas, useMaterial } from '@opentiny/tiny-engine-meta-register'
import { NODE_UID, NODE_LOOP } from '../../common'
import { NODE_UID, NODE_LOOP, DESIGN_MODE } from '../../common'
import { registerHostkeyEvent, removeHostkeyEvent } from './keyboard'
import CanvasMenu, { closeMenu, openMenu } from './components/CanvasMenu.vue'
import CanvasAction from './components/CanvasAction.vue'
Expand Down Expand Up @@ -117,6 +117,16 @@ export default {
}
}
const handleCanvasEvent = (handler) => {
const designMode = canvasApi.getDesignMode()
if (designMode !== DESIGN_MODE.DESIGN) {
return
}
return handler()
}
const canvasReady = ({ detail }) => {
if (iframe.value) {
// 设置monitor报错埋点
Expand All @@ -131,15 +141,17 @@ export default {
// 以下是内部iframe监听的事件
win.addEventListener('mousedown', (event) => {
// html元素使用scroll和mouseup事件处理
if (event.target === doc.documentElement) {
isScrolling = false
return
}
insertPosition.value = false
setCurrentNode(event)
target.value = event.target
handleCanvasEvent(() => {
// html元素使用scroll和mouseup事件处理
if (event.target === doc.documentElement) {
isScrolling = false
return
}
insertPosition.value = false
setCurrentNode(event)
target.value = event.target
})
})
win.addEventListener('scroll', () => {
Expand Down Expand Up @@ -168,7 +180,9 @@ export default {
})
win.addEventListener('mousemove', (ev) => {
dragMove(ev, true)
handleCanvasEvent(() => {
dragMove(ev, true)
})
})
// 阻止浏览器默认的右键菜单功能
Expand Down
6 changes: 6 additions & 0 deletions packages/canvas/container/src/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ export const getCurrent = () => {
}
}

export const getDesignMode = () => getRenderer()?.getDesignMode()

export const setDesignMode = (mode) => getRenderer()?.setDesignMode(mode)

export const getGlobalState = () => getRenderer().getGlobalState()

export const getNode = (id, parent) => getRenderer()?.getNode(id, parent)
Expand Down Expand Up @@ -893,6 +897,8 @@ export const canvasApi = {
setProps,
setGlobalState,
getGlobalState,
getDesignMode,
setDesignMode,
getDocument,
canvasDispatch,
BuiltinBundle,
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-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-common",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/configurator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-configurator",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"description": "",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/design-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"type": "module",
"description": "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.",
"homepage": "https://opentiny.design/tiny-engine",
Expand Down
2 changes: 1 addition & 1 deletion packages/engine-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-cli",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"description": "",
"main": "dist/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-i18n-host",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-layout",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"scripts": {
"build": "vite build"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/block/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-plugin-block",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/bridge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-plugin-bridge",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/datasource/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-plugin-datasource",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/help/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-plugin-help",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/i18n/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-plugin-i18n",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/materials/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-plugin-materials",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/page/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-plugin-page",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/robot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-plugin-robot",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/schema/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-plugin-schema",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/script/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-plugin-script",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/state/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-plugin-state",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/tree/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-plugin-tree",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
31 changes: 19 additions & 12 deletions packages/plugins/tree/src/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
class="tree-box"
:schemaId="data.row?.id"
:type="data.row.componentName"
@mouseover="mouseover(data.row, $event)"
@mouseleave="mouseleave(data.row, $event)"
@mouseover="mouseover(data.row)"
@mouseleave="mouseleave(data.row)"
@click="checkElement(data.row)"
>
<span class="tree-content">
Expand All @@ -57,7 +57,7 @@
</span> -->
<span>{{ data.row.componentName }}</span>
</span>
<span v-show="!data.row.show" class="tree-handle" @mouseup="showNode(data.row)">
<span v-show="data.row.showEye" class="tree-handle" @mouseup="showNode(data.row)">
<icon-eyeopen v-show="data.row.show"></icon-eyeopen>
<icon-eyeclose v-show="!data.row.show"></icon-eyeclose>
</span>
Expand Down Expand Up @@ -105,6 +105,7 @@ export default {
const translateChild = (data) => {
data.forEach((item) => {
item.show = pageState.nodesStatus[item.id] !== false
item.showEye = !item.show
const child = item.children
if (typeOf(child) !== 'array') {
delete item.children
Expand Down Expand Up @@ -171,23 +172,22 @@ export default {
return component.icon || 'IconAssociation'
}
const mouseover = (data, event) => {
const mouseover = (data) => {
if (state.isLock) {
return
}
const { hoverNode } = useCanvas().canvasApi.value
hoverNode(data.id)
const handleEl = event.target.querySelector('.tree-handle')
handleEl && (handleEl.style.display = 'block')
data.showEye = true
}
const mouseleave = (data, event) => {
const mouseleave = (data) => {
if (data && !data.show) {
return
}
event.target.querySelector('.tree-handle').style.display = 'none'
data.showEye = false
}
const checkElement = (row) => {
Expand Down Expand Up @@ -312,16 +312,23 @@ export default {
padding-top: 12px;
border-top: 1px solid var(--ti-lowcode-tree-border-color);
.tree-handle svg {
color: var(--ti-lowcode-tree-icon-color);
.tree-handle {
svg {
color: var(--ti-lowcode-tree-icon-color);
&:hover {
color: var(--ti-lowcode-tree-hover-icon-color);
&:hover {
color: var(--ti-lowcode-tree-hover-icon-color);
}
}
}
}
:deep(.tiny-grid) {
background-color: unset;
.tree-box {
display: flex;
width: 200px;
justify-content: space-between;
}
.tiny-grid-tree-wrapper {
margin-right: 8px;
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/tutorial/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-plugin-tutorial",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {
"access": "public"
},
Expand Down
Loading

0 comments on commit af1dc68

Please sign in to comment.