Skip to content

Commit

Permalink
Merge branch 'develop' into ospp-2024/003-react-dsl
Browse files Browse the repository at this point in the history
  • Loading branch information
hexqi committed Oct 31, 2024
2 parents ced63b0 + d90f0f2 commit 6f717e8
Show file tree
Hide file tree
Showing 119 changed files with 1,214 additions and 309 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ gantt
dateFormat YYYY-MM-DD
axisFormat %Y-%m-%d
1.0.0-beta.x version :active,2023-09-25, 2024-03-31
1.0.0-rc version : 2024-04-01, 2024-06-30
1.0.0 version : 2024-07-01, 2024-07-31
1.0.0-beta.x version : 2023-09-25, 2024-05-20
1.0.0-rc version(refactor version) : 2024-10-01
1.0.0 version : 2024-11-01
```

Expand Down
8 changes: 4 additions & 4 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ pnpm run build:alpha 或 build:prod
## 里程碑

```mermaid
gantt
gantt
dateFormat YYYY-MM-DD
axisFormat %Y-%m-%d
1.0.0-beta.x version :active,2023-09-25, 2024-03-31
1.0.0-rc version : 2024-04-01, 2024-06-30
1.0.0 version : 2024-07-01, 2024-07-31
1.0.0-beta.x version : 2023-09-25, 2024-05-20
1.0.0-rc version(refactor version) : 2024-10-01
1.0.0 version : 2024-11-01
```

Expand Down
4 changes: 2 additions & 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": "1.0.3",
"version": "1.0.6",
"publishConfig": {
"access": "public"
},
Expand All @@ -26,7 +26,7 @@
},
"dependencies": {
"@opentiny/tiny-engine-dsl-react": "workspace:*",
"@opentiny/tiny-engine-dsl-vue": "workspace:*",
"@opentiny/tiny-engine-dsl-vue": "^1.0.6",
"@seald-io/nedb": "^4.0.2",
"fs-extra": "^11.1.1",
"glob": "^10.3.4",
Expand Down
77 changes: 77 additions & 0 deletions mockServer/src/mock/get/app-center/v1/apps/schema/918.json
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,13 @@
"destructuring": true,
"version": "0.1.17"
},
{
"componentName": "TinyCheckbox",
"package": "@opentiny/vue",
"exportName": "Checkbox",
"destructuring": true,
"version": "3.14.0"
},
{
"componentName": "TinySelect",
"package": "@opentiny/vue",
Expand Down Expand Up @@ -1974,6 +1981,76 @@
"destructuring": true,
"version": "0.1.16"
},
{
"componentName": "TinyCollapse",
"package": "@opentiny/vue",
"exportName": "Collapse",
"destructuring": true,
"version": "3.14.0"
},
{
"componentName": "TinyCollapseItem",
"package": "@opentiny/vue",
"exportName": "CollapseItem",
"destructuring": true,
"version": "3.14.0"
},
{
"componentName": "TinyBreadcrumb",
"package": "@opentiny/vue",
"exportName": "Breadcrumb",
"destructuring": true,
"version": "3.14.0"
},
{
"componentName": "TinyBreadcrumbItem",
"package": "@opentiny/vue",
"exportName": "BreadcrumbItem",
"destructuring": true,
"version": "3.14.0"
},
{
"componentName": "ElInput",
"package": "element-plus",
"exportName": "ElInput",
"destructuring": true,
"version": "2.4.2"
},
{
"componentName": "ElButton",
"package": "element-plus",
"exportName": "ElButton",
"destructuring": true,
"version": "2.4.2"
},
{
"componentName": "ElForm",
"package": "element-plus",
"exportName": "ElForm",
"destructuring": true,
"version": "2.4.2"
},
{
"componentName": "ElFormItem",
"package": "element-plus",
"exportName": "ElFormItem",
"destructuring": true,
"version": "2.4.2"
},
{
"componentName": "ElTable",
"package": "element-plus",
"exportName": "ElTable",
"destructuring": true,
"version": "2.4.2"
},
{
"componentName": "ElTableColumn",
"package": "element-plus",
"exportName": "ElTableColumn",
"destructuring": true,
"version": "2.4.2"
},
{
"componentName": "PortalHome",
"main": "common/components/home",
Expand Down
3 changes: 2 additions & 1 deletion mockServer/src/services/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export default class BlockService {

async detail(blockId) {
const result = await this.db.findOneAsync({ _id: blockId })
return result

return getResponseData(result)
}

async delete(blockId) {
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
},
"devDependencies": {
"@babel/eslint-parser": "^7.21.3",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@types/node": "^18.0.0",
"@vitejs/plugin-vue": "^4.2.3",
"@vitejs/plugin-vue-jsx": "^3.1.0",
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": "1.0.2",
"version": "1.0.5",
"description": "translate block to webcomponent template",
"main": "./dist/web-components.es.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/blockToWebComponentTemplate/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default defineConfig(({ command, mode }) => {
}

const vuePluginConfig = {}
const styleLinks = ['https://npm.onmicrosoft.cn/@opentiny/[email protected]/index.css']
const styleLinks = ['https://unpkg.com/@opentiny/[email protected]/index.css']

config.publicDir = false

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": "1.0.1",
"version": "1.0.4",
"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": "1.0.3",
"version": "1.0.6",
"publishConfig": {
"access": "public"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/canvas/src/components/container/CanvasAction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ export default {
}
const showAction = computed(() => {
const { parent } = getCurrent()
const { schema, parent } = getCurrent()
if (schema?.props?.['data-id'] === 'root-container') {
return false
}
return !props.resize && parent && parent?.type !== 'JSSlot'
})
Expand Down
23 changes: 18 additions & 5 deletions packages/canvas/src/components/container/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ export const dragEnd = () => {
if (element && canvasState.type === 'absolute') {
data.props = data.props || {}
data.props.style = element.style.cssText

getController().addHistory()
}

// 重置拖拽状态
Expand Down Expand Up @@ -542,6 +544,8 @@ const setHoverRect = (element, data) => {
return undefined
}

let moveUpdateTimer = null

// 绝对布局
const absoluteMove = (event, element) => {
const { clientX, clientY } = event
Expand Down Expand Up @@ -573,6 +577,19 @@ const absoluteMove = (event, element) => {
element.style.height = `${clientY - y}px`
}
}

clearTimeout(moveUpdateTimer)

const { data } = dragState
data.props = data.props || {}

// 防抖更新位置信息到 schema
moveUpdateTimer = setTimeout(() => {
data.props.style = element.style.cssText

getController().addHistory()
}, 100)

updateRect()
}

Expand Down Expand Up @@ -717,11 +734,7 @@ export const onMouseUp = () => {
if (absolute) {
targetNode.node = getSchema()
data.props = data.props || {}
data.props.style = {
position: 'absolute',
top: dragState.mouse.y + 'px',
left: dragState.mouse.x + 'px'
}
data.props.style = `position: absolute; top: ${dragState.mouse.y}px; left: ${dragState.mouse.x}px`
}

insertNode(targetNode, position)
Expand Down
3 changes: 2 additions & 1 deletion packages/canvas/src/components/render/RenderMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ export default {
// 渲染画布增加根节点,与出码和预览保持一致
const rootChildrenSchema = {
componentName: 'div',
props: schema.props,
// 手动添加一个唯一的属性,后续在画布选中此节点时方便处理额外的逻辑。由于没有修改schema,不会影响出码
props: { ...schema.props, 'data-id': 'root-container' },
children: schema.children
}

Expand Down
2 changes: 1 addition & 1 deletion packages/canvas/src/components/render/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ const getBindProps = (schema, scope) => {
...parseData(schema.props, scope),
[DESIGN_UIDKEY]: id,
[DESIGN_TAGKEY]: componentName,
onMouseOver: stopEvent,
onMouseover: stopEvent,
onFocus: stopEvent
}
if (scope) {
Expand Down
4 changes: 2 additions & 2 deletions packages/common/component/BlockDeployDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ import {
FormItem as TinyFormItem
} from '@opentiny/vue'
import { theme } from '@opentiny/tiny-engine-controller/adapter'
import { useLayout, useNotify, useCanvas } from '@opentiny/tiny-engine-controller'
import { useLayout, useNotify, useCanvas, useBlock } from '@opentiny/tiny-engine-controller'
import { constants } from '@opentiny/tiny-engine-utils'
import VueMonaco from './VueMonaco.vue'
Expand Down Expand Up @@ -163,7 +163,7 @@ export default {
const { getEditBlock, publishBlock } = getPluginApi(PLUGIN_NAME.BlockManage)
if (valid) {
const params = {
block: getEditBlock(),
block: getEditBlock() || useBlock().getCurrentBlock(),
is_compile: true,
deploy_info: formState.deployInfo,
version: formState.version,
Expand Down
15 changes: 6 additions & 9 deletions packages/common/component/ConfigItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -295,16 +295,13 @@ export default {
result.message = typeof message === 'string' ? message : message?.[locale.value]
}

const isEmptyInputValue = (value) => {
// 通过 value == null 做隐式类型转换
// 空值约定为 undefined | null | ''
return value == null || (typeOf(value) === TYPES.StringType && value.trim() === '')
}
const verifyRequired = (value) => {
if (typeOf(value) === TYPES.BooleanType) {
return true
}

if (typeOf(value) === TYPES.StringType) {
return value.trim()
}

return value
return !isEmptyInputValue(value)
}

const verifyValue = (value = '', rules = []) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/component/LifeCycles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default {
})
watchEffect(() => {
state.bindLifeCycles = props.bindLifeCycles || useCanvas().canvasApi.value?.getSchema()?.lifeCycles || {}
state.bindLifeCycles = props.bindLifeCycles || {}
})
const searchLifeCyclesList = (value) => {
Expand Down
Loading

0 comments on commit 6f717e8

Please sign in to comment.