Skip to content
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

v2.1.0 #963

Merged
merged 19 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 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
60 changes: 30 additions & 30 deletions .github/workflows/push-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,40 @@ on:
push:
branches: []
pull_request:
branches: [develop,main, refactor/develop]
branches: [develop, main, refactor/develop, release/*]

jobs:
push-check:
runs-on: ubuntu-latest # windows-latest || macos-latest
runs-on: ubuntu-latest # windows-latest || macos-latest

steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
run: pnpm i
- name: Install dependencies
run: pnpm i

- name: Get changed files
id: get_changed_files
uses: tj-actions/changed-files@v41
with:
files: |
**.js
**.vue
**.jsx
- name: Run ESLint
run: npx eslint ${{steps.get_changed_files.outputs.all_changed_files}}
- name: Run Build
run: pnpm run build:plugin && pnpm run build:alpha > build-alpha.log 2>&1
- name: Get changed files
id: get_changed_files
uses: tj-actions/changed-files@v41
with:
files: |
**.js
**.vue
**.jsx
- name: Run ESLint
run: npx eslint ${{steps.get_changed_files.outputs.all_changed_files}}
- name: Run Build
run: pnpm run build:plugin && pnpm run build:alpha > build-alpha.log 2>&1
hexqi marked this conversation as resolved.
Show resolved Hide resolved

- name: Upload build logs
uses: actions/upload-artifact@v4
with:
name: build-alpha-log
path: build-alpha.log
- name: Upload build logs
uses: actions/upload-artifact@v4
with:
name: build-alpha-log
path: build-alpha.log
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",
"version": "2.1.0",
"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",
"version": "2.1.0",
"publishConfig": {
"access": "public"
},
Expand Down
7 changes: 3 additions & 4 deletions packages/block-compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/tiny-engine-block-compiler",
"version": "2.0.0-rc.2",
"version": "2.1.0",
"publishConfig": {
"access": "public"
},
Expand All @@ -27,7 +27,6 @@
"author": "OpenTiny Team",
"license": "MIT",
"homepage": "https://opentiny.design/tiny-engine",
"dependencies": {},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
Expand All @@ -43,7 +42,7 @@
"peerDependencies": {
"@babel/core": "^7.26.0",
"@vue/babel-plugin-jsx": "^1.2.5",
"vue": "^3.4.15",
"@vue/compiler-sfc": "^3.4.15"
"@vue/compiler-sfc": "^3.4.15",
"vue": "^3.4.15"
}
}
4 changes: 2 additions & 2 deletions packages/block-compiler/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface IResultMap {
[key: string]: compiledItem
}

const resolveRelativeImport = (code: string, globalGetterName = 'getBlockComponentBlobUrl') => {
const resolveRelativeImport = (code: string, globalGetterName = 'loadBlockComponent') => {
const magicStr = new MagicString(code)
const ast = babelParse(code, { sourceType: 'module', plugins: ['jsx'] }).program.body

Expand Down Expand Up @@ -86,7 +86,7 @@ const resolveRelativeImport = (code: string, globalGetterName = 'getBlockCompone
// 声明异步组件 const Block = defineAsyncComponent(() => import(getBlockUrl(Block)))
magicStr.appendLeft(
node.start!,
`const ${defaultImportId} = defineAsyncComponent(() => import(window.${globalGetterName}('${fileName}')))`
`const ${defaultImportId} = defineAsyncComponent(() => window.${globalGetterName}('${fileName}'))`
)

// 移除 import Block from './Block.vue' 语句
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",
"version": "2.1.0",
"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",
"version": "2.1.0",
"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",
"version": "2.1.0",
"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",
"version": "2.1.0",
"description": "",
"main": "dist/index.mjs",
"module": "dist/index.mjs",
Expand Down
3 changes: 2 additions & 1 deletion packages/canvas/DesignCanvas/src/DesignCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ export default {
// 1. 页面或区块状态是未保存状态(尝试编辑)
// 2. 页面刷新或第一次进入页面(含从别的页面或区块切换到别的页面或区块)
// 3. 页面上已经有弹窗,不允许重复弹窗
// 4. 当前历史堆栈为0,且当前未保存状态和上一次未保存状态不一致,不重复弹窗

const showConfirm = !isSaved || pageSchema !== oldPageSchema

if (!showConfirm || showModal) {
if (!showConfirm || showModal || (useHistory().historyState?.index === 0 && isSaved !== oldIsSaved)) {
return
}

Expand Down
19 changes: 12 additions & 7 deletions packages/canvas/DesignCanvas/src/api/useCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,18 @@ const operationTypeMap = {
}
}

if (position === 'after') {
if (position === 'before') {
parentNode.children.unshift(newNodeData)
} else {
parentNode.children.push(newNodeData)
setNode(newNodeData, parentNode)
}

// 递归构建 nodeMap
if (Array.isArray(newNodeData?.children) && newNodeData.children.length) {
const newNode = getNode(newNodeData.id)
generateNodesMap(newNodeData.children, newNode)
}
setNode(newNodeData, parentNode)

// 递归构建 nodeMap
if (Array.isArray(newNodeData?.children) && newNodeData.children.length) {
const newNode = getNode(newNodeData.id)
generateNodesMap(newNodeData.children, newNode)
}

return {
Expand Down Expand Up @@ -515,6 +518,8 @@ const importSchema = (data) => {
resetCanvasState({
pageSchema: importData
})

canvasApi.value?.clearSelect?.()
}

const exportSchema = () => {
Expand Down
11 changes: 10 additions & 1 deletion packages/canvas/container/src/components/CanvasResize.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</template>
<script>
import { ref, computed, watch, nextTick } from 'vue'
import { useLayout } from '@opentiny/tiny-engine-meta-register'
import { useLayout, useCanvas } from '@opentiny/tiny-engine-meta-register'
import { canvasState } from '../container'

export default {
Expand Down Expand Up @@ -106,6 +106,15 @@ export default {
{ flush: 'post' }
)

watch(
() => sizeStyle.value,
() => {
nextTick(() => {
useCanvas().canvasApi.value?.updateRect?.()
})
}
)

return {
onMouseDown,
onMouseMove,
Expand Down
4 changes: 2 additions & 2 deletions packages/canvas/container/src/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,8 @@ export const canvasApi = {
getDocument,
canvasDispatch,
Builtin,
removeBlockCompsCacheByName: (...args) => {
return canvasState.renderer.removeBlockCompsCacheByName(...args)
removeBlockCompsCache: (...args) => {
return canvasState.renderer.removeBlockCompsCache(...args)
},
updateCanvas: (...args) => {
return canvasState.renderer.updateCanvas(...args)
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",
"version": "2.1.0",
"publishConfig": {
"access": "public"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/canvas/render/src/RenderMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import renderer, {
setController,
globalNotify,
isStateAccessor,
removeBlockCompsCacheByName
removeBlockCompsCache
} from './render'
import { setContext, getContext, setCondition, context, getDesignMode, setDesignMode } from './context'
import CanvasEmpty from './CanvasEmpty.vue'
Expand Down Expand Up @@ -505,6 +505,6 @@ export const api = {
setRenderer,
getDesignMode,
setDesignMode,
removeBlockCompsCacheByName,
removeBlockCompsCache,
updateCanvas
}
16 changes: 8 additions & 8 deletions packages/canvas/render/src/builtin/builtin.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"content": [
{
"property": "name",
"type": "String",
"type": "string",
"label": {
"text": {
"zh_CN": "插槽名称"
Expand All @@ -97,7 +97,7 @@
},
{
"property": "params",
"type": "String",
"type": "string",
"defaultValue": "",
"label": {
"text": {
Expand Down Expand Up @@ -157,7 +157,7 @@
"content": [
{
"property": "condition",
"type": "Boolean",
"type": "boolean",
"defaultValue": true,
"label": {
"text": {
Expand All @@ -173,7 +173,7 @@
},
{
"property": "style",
"type": "String",
"type": "string",
"defaultValue": "",
"label": {
"text": {
Expand All @@ -189,7 +189,7 @@
},
{
"property": "dataSource",
"type": "String",
"type": "string",
"defaultValue": "",
"bindState": false,
"label": {
Expand Down Expand Up @@ -243,7 +243,7 @@
"content": [
{
"property": "text",
"type": "String",
"type": "string",
"defaultValue": "TinyEngine 前端可视化设计器,为设计器开发者提供定制服务,在线构建出自己专属的设计器。",
"label": {
"text": {
Expand Down Expand Up @@ -315,7 +315,7 @@
"content": [
{
"property": "name",
"type": "String",
"type": "string",
"defaultValue": "IconDel",
"bindState": true,
"label": {
Expand Down Expand Up @@ -385,7 +385,7 @@
"content": [
{
"property": "src",
"type": "String",
"type": "string",
"defaultValue": "",
"bindState": true,
"label": {
Expand Down
Loading
Loading